• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XmlTest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: currentSuiteTitleTest

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


示例17: getMethodBrowserConfiguration

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


示例18: getClassBrowserConfiguration

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


示例19: object

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


示例20: runTests

import org.testng.xml.XmlTest; //导入依赖的package包/类
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();

	}
 
开发者ID:dandeyagna,项目名称:testng-keyword-driven,代码行数:28,代码来源:TestNGDriver.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FileUtils类代码示例发布时间:2022-05-21
下一篇:
Java Nonce类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap