Java 类org.testng.xml.XmlTest 实例源码

项目:sunshine    文件:LoadableTestNGSuite.java   
@Override
public File tests() throws SuiteException {
    XmlSuite xmlSuite = new XmlSuite();
    xmlSuite.setName(SUITE_NAME);
    try {
        for (SunshineTest sunshineTest : this.artifacts.tests()) {
            XmlTest test = new TestNGTest(sunshineTest).object();
            test.setSuite(xmlSuite);
            xmlSuite.addTest(test);
        }
        this.suiteXml.write(xmlSuite.toXml());
        return this.suiteXml;
    } catch (TestException | IOException e) {
        throw new SuiteException(e);
    }
}
项目:qaf    文件:TestClass.java   
private void init(IClass cls,
                  ITestMethodFinder testMethodFinder,
                  IAnnotationFinder annotationFinder,
                  RunInfo runInfo,
                  XmlTest xmlTest,
                  XmlClass xmlClass)
{
  log(3, "Creating TestClass for " + cls);
  m_iClass = cls;
  m_testClass = cls.getRealClass();
  m_xmlTest = xmlTest;
  m_xmlClass = xmlClass;
  m_runInfo = runInfo;
  m_testMethodFinder = testMethodFinder;
  m_annotationFinder = annotationFinder;
  initTestClassesAndInstances();
  initMethods();
}
项目:qaf    文件:TestRunner.java   
private void initRunInfo(final XmlTest xmlTest) {
  // Groups
  m_xmlMethodSelector.setIncludedGroups(createGroups(m_xmlTest.getIncludedGroups()));
  m_xmlMethodSelector.setExcludedGroups(createGroups(m_xmlTest.getExcludedGroups()));
  m_xmlMethodSelector.setExpression(m_xmlTest.getExpression());

  // Methods
  m_xmlMethodSelector.setXmlClasses(m_xmlTest.getXmlClasses());

  m_runInfo.addMethodSelector(m_xmlMethodSelector, 10);

  // Add user-specified method selectors (only class selectors, we can ignore
  // script selectors here)
  if (null != xmlTest.getMethodSelectors()) {
    for (org.testng.xml.XmlMethodSelector selector : xmlTest.getMethodSelectors()) {
      if (selector.getClassName() != null) {
        IMethodSelector s = ClassHelper.createSelector(selector);

        m_runInfo.addMethodSelector(s, selector.getPriority());
      }
    }
  }
}
项目:qaf    文件:TestRunner.java   
/**
 * The main entry method for TestRunner.
 *
 * This is where all the hard work is done:
 * - Invoke configuration methods
 * - Invoke test methods
 * - Catch exceptions
 * - Collect results
 * - Invoke listeners
 * - etc...
 */
public void run() {
  beforeRun();

  try {
    XmlTest test= getTest();
    if(test.isJUnit()) {
      privateRunJUnit(test);
    }
    else {
      privateRun(test);
    }
  }
  finally {
    afterRun();
  }
}
项目:video-recorder-java    文件:BaseTest.java   
protected ITestResult prepareMock(Class<?> tClass, Method method) {
  ITestResult result = mock(ITestResult.class);
  IClass clazz = mock(IClass.class);
  ITestNGMethod testNGMethod = mock(ITestNGMethod.class);
  ConstructorOrMethod cm = mock(ConstructorOrMethod.class);
  String methodName = method.getName();
  when(result.getTestClass()).thenReturn(clazz);
  when(result.getTestClass().getRealClass()).thenReturn(tClass);
  when(clazz.getName()).thenReturn(this.getClass().getName());
  when(result.getMethod()).thenReturn(testNGMethod);
  when(cm.getMethod()).thenReturn(method);
  when(result.getMethod().getConstructorOrMethod()).thenReturn(cm);
  when(testNGMethod.getMethodName()).thenReturn(methodName);
  ITestContext context = mock(ITestContext.class);
  when(result.getTestContext()).thenReturn(context);
  XmlTest xmlTest = new XmlTest();
  XmlSuite suite = new XmlSuite();
  xmlTest.setXmlSuite(suite);
  suite.setListeners(Arrays.asList(VideoListener.class.getName()));
  when(context.getCurrentXmlTest()).thenReturn(xmlTest);
  return result;
}
项目:intellij-ce-playground    文件:TestNGTreeHierarchyTest.java   
@Test
public void testOneTestMethod() throws Exception {
  final XmlSuite suite = new XmlSuite();
  final XmlTest test = new XmlTest();
  final XmlClass xmlClass = new XmlClass("a.ATest", false);
  xmlClass.getIncludedMethods().add(new XmlInclude("test1"));
  test.getClasses().add(xmlClass);
  suite.getTests().add(test);

  doTest(suite,"##teamcity[enteredTheMatrix]\n" +
               "\n" +
                "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" +
                "\n" +
                "##teamcity[testStarted name='ATest.test1|[0|]' locationHint='java:test://a.ATest.test1|[0|]']\n" +
                "\n" +
                "##teamcity[testFinished name='ATest.test1|[0|]']\n");
}
项目:intellij-ce-playground    文件:TestNGTreeHierarchyTest.java   
@Test
public void testOneTestMethodWithMultipleInvocationCount() throws Exception {
  final XmlSuite suite = new XmlSuite();
  final XmlTest test = new XmlTest();
  final XmlClass xmlClass = new XmlClass("a.ATest", false);
  xmlClass.getIncludedMethods().add(new XmlInclude("test1", Arrays.asList(0, 1, 2), 0));
  test.getClasses().add(xmlClass);
  suite.getTests().add(test);

  doTest(suite, "##teamcity[enteredTheMatrix]\n" +
                "\n" +
                "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" +
                "\n" +
                "##teamcity[testStarted name='ATest.test1|[0|]' locationHint='java:test://a.ATest.test1|[0|]']\n" +
                "\n" +
                "##teamcity[testFinished name='ATest.test1|[0|]']\n" +
                "\n" +
                "##teamcity[testStarted name='ATest.test1|[1|] (1)' locationHint='java:test://a.ATest.test1|[1|]']\n" +
                "\n" +
                "##teamcity[testFinished name='ATest.test1|[1|] (1)']\n" +
                "\n" +
                "##teamcity[testStarted name='ATest.test1|[2|] (2)' locationHint='java:test://a.ATest.test1|[2|]']\n" +
                "\n" +
                "##teamcity[testFinished name='ATest.test1|[2|] (2)']\n");
}
项目:intellij-ce-playground    文件:TestNGTreeHierarchyTest.java   
private static void doTest(XmlSuite suite, String expected) {
  final StringBuffer buf = new StringBuffer();
  final IDEATestNGRemoteListener listener = createListener(buf);

  for (XmlTest test : suite.getTests()) {
    for (XmlClass aClass : test.getClasses()) {
      final String classFQName = aClass.getName();
      for (XmlInclude include : aClass.getIncludedMethods()) {
        final String methodName = include.getName();
        List<Integer> numbers = include.getInvocationNumbers();
        if (numbers.isEmpty()) {
          numbers = Collections.singletonList(0);
        }
        for (Integer integer : numbers) {
          final MockTestNGResult result = new MockTestNGResult(classFQName, methodName, null, new Object[] {integer});
          listener.onTestStart(result);
          listener.onTestFinished(result);
        }
      }
    }
  }

  Assert.assertEquals("output: " + buf, expected, StringUtil.convertLineSeparators(buf.toString()));
}
项目:testng-remote    文件:RemoteTestNG6_5.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
      @Override
      public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
                                      List<IInvokedMethodListener> listeners) {
        TestRunner runner =
                new TestRunner(getConfiguration(), suite, xmlTest,
                        false /*skipFailedInvocationCounts */,
                        listeners);
        if (m_useDefaultListeners) {
          runner.addListener(new TestHTMLReporter());
          runner.addListener(new JUnitXMLReporter());
        }
        for (IConfigurationListener cl : getConfiguration().getConfigurationListeners()) {
          runner.addListener(cl);
        }

        return runner;
      }
    };
  }

  return m_customTestRunnerFactory;
}
项目:testng-remote    文件:RemoteTestNG6_10.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
        @Override
        public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
            Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
          TestRunner runner =
            new TestRunner(getConfiguration(), suite, xmlTest,
                false /*skipFailedInvocationCounts */,
                listeners, classListeners);
          if (m_useDefaultListeners) {
            runner.addListener(new TestHTMLReporter());
            runner.addListener(new JUnitXMLReporter());
          }

          return runner;
        }
      };
  }

  return m_customTestRunnerFactory;
}
项目:testng-remote    文件:RemoteTestNG6_9_7.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
        @Override
        public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
            Collection<IInvokedMethodListener> listeners) {
          TestRunner runner =
            new TestRunner(getConfiguration(), suite, xmlTest,
                false /*skipFailedInvocationCounts */,
                listeners);
          if (m_useDefaultListeners) {
            runner.addListener(new TestHTMLReporter());
            runner.addListener(new JUnitXMLReporter());
          }
          for (IConfigurationListener cl : getConfiguration().getConfigurationListeners()) {
            runner.addListener(cl);
          }

          return runner;
        }
      };
  }

  return m_customTestRunnerFactory;
}
项目:testng-remote    文件:RemoteTestNG6_9_10.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
        @Override
        public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
            Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
          TestRunner runner =
            new TestRunner(getConfiguration(), suite, xmlTest,
                false /*skipFailedInvocationCounts */,
                listeners, classListeners);
          if (m_useDefaultListeners) {
            runner.addListener(new TestHTMLReporter());
            runner.addListener(new JUnitXMLReporter());
          }
          for (IConfigurationListener cl : getConfiguration().getConfigurationListeners()) {
            runner.addListener(cl);
          }

          return runner;
        }
      };
  }

  return m_customTestRunnerFactory;
}
项目:testng-remote    文件:RemoteTestNG6_12.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
        @Override
        public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
            Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
          TestRunner runner =
            new TestRunner(getConfiguration(), suite, xmlTest,
                false /*skipFailedInvocationCounts */,
                listeners, classListeners);
          if (m_useDefaultListeners) {
            runner.addListener(new TestHTMLReporter());
            runner.addListener(new JUnitXMLReporter());
          }

          return runner;
        }
      };
  }

  return m_customTestRunnerFactory;
}
项目:testng-remote    文件:RemoteTestNG6_0.java   
@Override
protected ITestRunnerFactory buildTestRunnerFactory() {
  if(null == m_customTestRunnerFactory) {
    m_customTestRunnerFactory= new ITestRunnerFactory() {
      @Override
      public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
                                      List<IInvokedMethodListener> listeners) {
        TestRunner runner =
                new TestRunner(getConfiguration(), suite, xmlTest,
                        false /*skipFailedInvocationCounts */,
                        listeners);
        if (m_useDefaultListeners) {
          runner.addListener(new TestHTMLReporter());
          runner.addListener(new JUnitXMLReporter());
        }

        return runner;
      }
    };
  }

  return m_customTestRunnerFactory;
}
项目:tempto    文件:TemptoRunner.java   
private XmlSuite getXmlSuite()
{
    // we cannot use singletonLists here as testNG later
    // modifies lists stored in XmlSuite ... zonk
    XmlSuite testSuite = new XmlSuite();
    testSuite.setName("tempto-tests");
    testSuite.setFileName("tempto-tests");
    XmlTest test = new XmlTest(testSuite);
    test.setName("all");
    XmlPackage testPackage = new XmlPackage(options.getTestsPackage());
    List<XmlPackage> testPackages = newArrayList(testPackage);
    test.setPackages(testPackages);
    XmlClass conventionBasedTestsClass = new XmlClass("io.prestodb.tempto.internal.convention.ConventionBasedTestFactory");
    List<XmlClass> classes = newArrayList(conventionBasedTestsClass);
    test.setClasses(classes);
    test.setParallel(XmlSuite.ParallelMode.METHODS);
    return testSuite;
}
项目:allure1    文件:AllureTestListenerTest.java   
@Before
public void setUp() {
    testngListener = spy(new AllureTestListener());
    allure = mock(Allure.class);

    testngListener.setLifecycle(allure);

    ISuite suite = mock(ISuite.class);
    when(suite.getName()).thenReturn(DEFAULT_SUITE_NAME);
    XmlTest xmlTest = mock(XmlTest.class);
    when(xmlTest.getName()).thenReturn(DEFAULT_XML_TEST_NAME);
    testContext = mock(ITestContext.class);
    when(testContext.getSuite()).thenReturn(suite);
    when(testContext.getCurrentXmlTest()).thenReturn(xmlTest);

    // mocking test method parameters
    ConstructorOrMethod constructorOrMethod = mock(ConstructorOrMethod.class);
    when(constructorOrMethod.getMethod()).thenReturn(parametrizedTestMethod(0, null, null, null));
    method = mock(ITestNGMethod.class);
    when(method.getConstructorOrMethod()).thenReturn(constructorOrMethod);
    testResult = mock(ITestResult.class);
    when(testResult.getMethod()).thenReturn(method);
    when(testResult.getParameters()).thenReturn(new Object[]{});
    IClass iClass = mock(IClass.class);
    when(testResult.getTestClass()).thenReturn(iClass);
}
项目:allure1    文件:AllureTestListenerTest.java   
@Test
public void currentSuiteTitleTest() throws Exception {
    Map<String, String> params = new HashMap<>();
    params.put("key", "value");
    XmlTest xmlTest = mock(XmlTest.class);
    when(xmlTest.getLocalParameters()).thenReturn(params);
    when(xmlTest.getName()).thenReturn("xmlName");

    ITestContext iTestContext = mock(ITestContext.class);
    when(iTestContext.getCurrentXmlTest()).thenReturn(xmlTest);

    ISuite iSuite = mock(ISuite.class);
    when(iSuite.getName()).thenReturn("name");
    when(iTestContext.getSuite()).thenReturn(iSuite);

    String name = testngListener.getCurrentSuiteTitle(iTestContext);
    assertThat(name, is("name : xmlName[key=value]"));
}
项目:webdriver-supplier    文件:TestNGUtils.java   
public static Optional<XmlConfig> getMethodBrowserConfiguration(final XmlTest xmlTest, final String method) {
    return StreamEx.of(xmlTest.getClasses())
                   .flatMap(xmlClass -> StreamEx.of(xmlClass.getIncludedMethods()))
                   .filter(xmlInclude -> xmlInclude.getName().equals(method))
                   .map(XmlInclude::getAllParameters)
                   .map(parameters -> mapConfiguration(parameters, method))
                   .findFirst();
}
项目:webdriver-supplier    文件:TestNGUtils.java   
public static Optional<XmlConfig> getClassBrowserConfiguration(final XmlTest xmlTest, final String method) {
    return StreamEx.of(xmlTest.getClasses())
                   .filter(xmlClass -> isMethodPresent(xmlClass, method))
                   .map(XmlClass::getAllParameters)
                   .map(parameters -> mapConfiguration(parameters, method))
                   .findFirst();
}
项目:sunshine    文件:TestNGTest.java   
@Override
public XmlTest object() throws TestException {
    XmlTest xmlTest = new XmlTest();
    xmlTest.setName(test.toString());
    xmlTest.setXmlClasses(Collections.singletonList(new XmlClass(test.object(), false)));
    return xmlTest;
}
项目:testng-keyword-driven    文件:TestNGDriver.java   
public  void runTests(KWDTestCase kwdTestCase, String testSuiteName, String outputDirectory) {

        this.kwdTestCase = kwdTestCase;
        XmlSuite suite = new XmlSuite();
        suite.setName(testSuiteName);
        XmlTest xmlTest = new XmlTest(suite);
        xmlTest.setName(kwdTestCase.getTestCaseName());
        xmlTest.setVerbose(0);
        System.out.println("Total number of Tests to be run: " + kwdTestCase.getTestMethods().size());
        {
            XmlClass xmlClass = new XmlClass("com.carteblanche.kwd.testng.TestNGDriver");
            xmlTest.getClasses().add(xmlClass);
            List<XmlInclude> xmlIncludeMethods = xmlClass.getIncludedMethods();
            XmlInclude xmlInclude = new XmlInclude("runnableTest");
            xmlIncludeMethods.add(xmlInclude);
            xmlClass.setIncludedMethods(xmlIncludeMethods);
        }

        System.out.println("Running Tests using command ..");

        testNG.setXmlSuites(Arrays.asList(suite));
        testNG.setPreserveOrder(true);
        testNG.setUseDefaultListeners(true);
        testNG.setOutputDirectory(outputDirectory);
        testNG.run();

    }
项目:qaf    文件:TestClass.java   
protected TestClass(IClass cls,
                 ITestMethodFinder testMethodFinder,
                 IAnnotationFinder annotationFinder,
                 RunInfo runInfo,
                 XmlTest xmlTest,
                 XmlClass xmlClass) {
  init(cls, testMethodFinder, annotationFinder, runInfo, xmlTest, xmlClass);
}
项目:qaf    文件:TestRunner.java   
protected TestRunner(IConfiguration configuration,
                  ISuite suite,
                  XmlTest test,
                  String outputDirectory,
                  IAnnotationFinder finder,
                  boolean skipFailedInvocationCounts,
                  Collection<IInvokedMethodListener> invokedMethodListeners,
                  List<IClassListener> classListeners)
{
  init(configuration, suite, test, outputDirectory, finder, skipFailedInvocationCounts,
      invokedMethodListeners, classListeners);
}
项目:qaf    文件:TestRunner.java   
public TestRunner(IConfiguration configuration, ISuite suite, XmlTest test,
    boolean skipFailedInvocationCounts,
    Collection<IInvokedMethodListener> invokedMethodListeners,
    List<IClassListener> classListeners) {
  init(configuration, suite, test, suite.getOutputDirectory(),
      suite.getAnnotationFinder(),
      skipFailedInvocationCounts, invokedMethodListeners, classListeners);
}
项目:qaf    文件:TestRunner.java   
/**
 * Initialize meta groups
 */
private void initMetaGroups(XmlTest xmlTest) {
  Map<String, List<String>> metaGroups = xmlTest.getMetaGroups();

  for (Map.Entry<String, List<String>> entry : metaGroups.entrySet()) {
    addMetaGroup(entry.getKey(), entry.getValue());
  }
}
项目:intellij-ce-playground    文件:IDEATestNGRemoteListener.java   
public List<String> getTestHierarchy() {
  final List<String> hierarchy;
  final XmlTest xmlTest = myResult.getTestClass().getXmlTest();
  if (xmlTest != null) {
    hierarchy = Arrays.asList(getClassName(), xmlTest.getName());
  } else {
    hierarchy = Collections.singletonList(getClassName());
  }
  return hierarchy;
}
项目:intellij-ce-playground    文件:TestNGXmlSuiteHelper.java   
public static File writeSuite(Map<String, Map<String, List<String>>> map, 
                              Map<String, String> testParams, 
                              String name,
                              String rootPath,
                              Logger logger) {
  File xmlFile;
  final XmlSuite xmlSuite = new XmlSuite();
  xmlSuite.setParameters(testParams);
  XmlTest xmlTest = new XmlTest(xmlSuite);
  xmlTest.setName(name);
  List<XmlClass> xmlClasses = new ArrayList<XmlClass>();
  int idx = 0;
  for (String className : map.keySet()) {
    final XmlClass xmlClass = new XmlClass(className, idx++, false);
    final Map<String, List<String>> collection = map.get(className);
    if (collection != null) {
      final ArrayList<XmlInclude> includedMethods = new ArrayList<XmlInclude>();
      int mIdx = 0;
      for (String methodName : collection.keySet()) {
        final List<Integer> includes = new ArrayList<Integer>();
        for (String include : collection.get(methodName)) {
          try {
            includes.add(Integer.parseInt(include));
          }
          catch (NumberFormatException e) {
            logger.log(e);
          }
        }
        includedMethods.add(new XmlInclude(methodName, includes, mIdx++));
      }
      xmlClass.setIncludedMethods(includedMethods);
    }
    xmlClasses.add(xmlClass);
  }
  xmlTest.setXmlClasses(xmlClasses);
  xmlFile = new File(rootPath, "temp-testng-customsuite.xml");
  final String toXml = xmlSuite.toXml();
  writeToFile(logger, xmlFile, toXml);
  return xmlFile;
}
项目:testng-remote    文件:RemoteTestNG6_5.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    List<IInvokedMethodListener> listeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners);
  tr.addListener(new RemoteTestListener(suite, test, m_messageSender));
  return tr;
}
项目:testng-remote    文件:RemoteTestNG6_10.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners, classListeners);
  tr.addListener(new RemoteTestListener(suite, test, m_messageSender));
  return tr;
}
项目:testng-remote    文件:RemoteTestNG6_9_7.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    Collection<IInvokedMethodListener> listeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners);
  tr.addListener(new RemoteTestListener(suite, test, m_messageSender));
  return tr;
}
项目:testng-remote    文件:RemoteTestNG6_9_10.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners, classListeners);
  tr.addListener(new RemoteTestListener(suite, test, m_messageSender));
  return tr;
}
项目:testng-remote    文件:SimpleBaseTest.java   
protected XmlTest createXmlTest(XmlSuite suite, String name, String... classes) {
  XmlTest result = new XmlTest(suite);
  int index = 0;
  result.setName(name);
  for (String c : classes) {
    XmlClass xc = new XmlClass(c, index++, true /* load classes */);
    result.getXmlClasses().add(xc);
  }

  return result;
}
项目:testng-remote    文件:RemoteTestNG6_12.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners, classListeners);
  tr.addListener(new RemoteTestListener(suite, test, m_messageSender));
  return tr;
}
项目:testng-remote    文件:RemoteTestNG6_0.java   
@Override
public TestRunner newTestRunner(ISuite suite, XmlTest test,
    List<IInvokedMethodListener> listeners) {
  TestRunner tr = m_delegateFactory.newTestRunner(suite, test, listeners);
  tr.addListener(new RemoteTestListener1(suite, test, m_messageSender));
  return tr;
}
项目:esBench    文件:AbstractElasticSearchIntegrationTest.java   
@BeforeClass
public void startServer(ITestContext context, XmlTest test) {
    String name = getTestName();
    String dir = "target/es-data" + name;
    LOGGER.warn("Creating Elasticsearch {}", name);
    embeddedServer = new EmbeddedElasticSearchServer(dir, name);
}
项目:esBench    文件:AbstractSharedElasticSearchIntegrationTest.java   
@BeforeSuite
public void startServer(ITestContext context, XmlTest test) {
    String name = context.getSuite().getName();
    String dir = "target/es-data" + name;
    LOGGER.warn("Creating Elasticsearch {}", name);
    embeddedServer = new EmbeddedElasticSearchServer(dir, name);
}
项目:seleniumtestsframework    文件:SeleniumTestPlan.java   
@BeforeMethod(alwaysRun = true)
public void beforeTestMethod(final Object[] parameters, final Method method, final ITestContext testContex,
        final XmlTest xmlTest) {
    logger.info(Thread.currentThread() + " Start method " + method.getName());
    SeleniumTestsContextManager.initThreadContext(testContex, xmlTest);
    if (method != null) {
        SeleniumTestsContextManager.getThreadContext().setAttribute(SeleniumTestsContext.TEST_METHOD_SIGNATURE,
            buildMethodSignature(method, parameters));
    }
}
项目:seleniumtestsframework    文件:SeleniumTestPlan.java   
/**
 * clean up.
 *
 * @param  parameters
 * @param  method
 * @param  testContex
 * @param  xmlTest
 */
@AfterMethod(alwaysRun = true)
public void afterTestMethod(final Object[] parameters, final Method method, final ITestContext testContex,
        final XmlTest xmlTest) {
    final List<TearDownService> serviceList = SeleniumTestsContextManager.getThreadContext().getTearDownServices();
    if (serviceList != null && !serviceList.isEmpty()) {
        for (final TearDownService service : serviceList) {
            service.tearDown();
        }
    }

    WebUIDriver.cleanUp();
    logger.info(Thread.currentThread() + " Finish method " + method.getName());
}
项目:seleniumtestsframework    文件:SeleniumTestsContextManager.java   
public static void initTestLevelContext(final ITestContext testNGCtx, final XmlTest xmlTest) {
    SeleniumTestsContext seleniumTestsCtx = new SeleniumTestsContext(testNGCtx);
    if (xmlTest != null) {
        Map<String, String> testParameters = xmlTest.getTestParameters();

        // parse the test level parameters
        for (Entry<String, String> entry : testParameters.entrySet()) {
            seleniumTestsCtx.setAttribute(entry.getKey(), entry.getValue());
        }

    }

    testLevelContext.put(xmlTest.getName(), seleniumTestsCtx);
}
项目:che    文件:TestResultWrapper.java   
/** @return the fileName or null if the test tag this class was found in. */
public String getFileName() {
  XmlTest xmlTest = testResult.getTestClass().getXmlTest();
  if (xmlTest != null) {
    return xmlTest.getSuite().getFileName();
  }
  return null;
}