当前位置: 首页>>代码示例>>Java>>正文


Java XmlTest类代码示例

本文整理汇总了Java中org.testng.xml.XmlTest的典型用法代码示例。如果您正苦于以下问题:Java XmlTest类的具体用法?Java XmlTest怎么用?Java XmlTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmlTest类属于org.testng.xml包,在下文中一共展示了XmlTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tests

import org.testng.xml.XmlTest; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:tatools,项目名称:sunshine,代码行数:17,代码来源:LoadableTestNGSuite.java

示例2: init

import org.testng.xml.XmlTest; //导入依赖的package包/类
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();
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:19,代码来源:TestClass.java

示例3: initRunInfo

import org.testng.xml.XmlTest; //导入依赖的package包/类
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());
      }
    }
  }
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:24,代码来源:TestRunner.java

示例4: run

import org.testng.xml.XmlTest; //导入依赖的package包/类
/**
 * 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();
  }
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:28,代码来源:TestRunner.java

示例5: prepareMock

import org.testng.xml.XmlTest; //导入依赖的package包/类
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;
}
 
开发者ID:SergeyPirogov,项目名称:video-recorder-java,代码行数:23,代码来源:BaseTest.java

示例6: testOneTestMethod

import org.testng.xml.XmlTest; //导入依赖的package包/类
@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");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TestNGTreeHierarchyTest.java

示例7: testOneTestMethodWithMultipleInvocationCount

import org.testng.xml.XmlTest; //导入依赖的package包/类
@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");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TestNGTreeHierarchyTest.java

示例8: doTest

import org.testng.xml.XmlTest; //导入依赖的package包/类
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()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:TestNGTreeHierarchyTest.java

示例9: buildTestRunnerFactory

import org.testng.xml.XmlTest; //导入依赖的package包/类
@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;
}
 
开发者ID:testng-team,项目名称:testng-remote,代码行数:27,代码来源:RemoteTestNG6_5.java

示例10: buildTestRunnerFactory

import org.testng.xml.XmlTest; //导入依赖的package包/类
@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;
}
 
开发者ID:testng-team,项目名称:testng-remote,代码行数:24,代码来源:RemoteTestNG6_10.java

示例11: buildTestRunnerFactory

import org.testng.xml.XmlTest; //导入依赖的package包/类
@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;
}
 
开发者ID:testng-team,项目名称:testng-remote,代码行数:27,代码来源:RemoteTestNG6_9_7.java

示例12: buildTestRunnerFactory

import org.testng.xml.XmlTest; //导入依赖的package包/类
@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;
}
 
开发者ID:testng-team,项目名称:testng-remote,代码行数:27,代码来源:RemoteTestNG6_9_10.java

示例13: buildTestRunnerFactory

import org.testng.xml.XmlTest; //导入依赖的package包/类
@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;
}
 
开发者ID:testng-team,项目名称:testng-remote,代码行数:24,代码来源:RemoteTestNG6_0.java

示例14: getXmlSuite

import org.testng.xml.XmlTest; //导入依赖的package包/类
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;
}
 
开发者ID:prestodb,项目名称:tempto,代码行数:19,代码来源:TemptoRunner.java

示例15: setUp

import org.testng.xml.XmlTest; //导入依赖的package包/类
@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);
}
 
开发者ID:allure-framework,项目名称:allure1,代码行数:27,代码来源:AllureTestListenerTest.java


注:本文中的org.testng.xml.XmlTest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。