org.testng.TestNG.setJUnit()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.testng.TestNG.setJUnit()方法的一些代码示例,展示了TestNG.setJUnit()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TestNG.setJUnit()方法的具体详情如下:
包路径:org.testng.TestNG
类名称:TestNG
方法名:setJUnit

TestNG.setJUnit介绍

[英]Specify if this run should be made in JUnit mode
[中]指定此运行是否应在JUnit模式下进行

代码示例

代码示例来源:origin: cbeust/testng

@Test
  public void testMethod() {
    TestNG testng = create(Issue323TestSample.class);
    Issue323JUnitInvocationListener listener = new Issue323JUnitInvocationListener();
    testng.addListener((ITestNGListener) listener);
    testng.setJUnit(true);
    testng.run();
    assertThat(Issue323JUnitInvocationListener.messages).containsExactly("beforeInvocation", "afterInvocation");
  }
}

代码示例来源:origin: cbeust/testng

private Listener runJunitTest(String src, String name) throws Exception {
 TestNG tng = new TestNG(false);
 Class<?> testClass = compile(src, name);
 Listener listener = new Listener();
 tng.setJUnit(true);
 tng.addClassLoader(testClass.getClassLoader());
 assertNotEquals(testClass.getClassLoader(), this.getClass().getClassLoader(),
         "JUnit test must be loaded by a different classloader");
 try {
   this.getClass().getClassLoader().loadClass(testClass.getName());
   fail("it must be imposiible to load JUnit test by current classloader");
 } catch (ClassNotFoundException c) {
 }
 tng.setTestClasses(new Class<?>[]{testClass});
 tng.addListener(listener);
 tng.run();
 return listener;
}

代码示例来源:origin: org.testng/testng

setTestJar(cla.testJar);
setXmlPathInJar(cla.xmlPathInJar);
setJUnit(cla.junit);
setMixed(cla.mixed);
setSkipFailedInvocationCounts(cla.skipFailedInvocationCounts);

代码示例来源:origin: cbeust/testng

setTestJar(cla.testJar);
setXmlPathInJar(cla.xmlPathInJar);
setJUnit(cla.junit);
setMixed(cla.mixed);
setSkipFailedInvocationCounts(cla.skipFailedInvocationCounts);

相关文章

TestNG类方法