/** * The TestNG entry point for command line execution. * * @param argv the TestNG command line parameters. * @throws FileNotFoundException */ public static void main(String[] argv) { TestNG testng = privateMain(argv, null); System.exit(testng.getStatus()); }
/** * The TestNG entry point for command line execution. * * @param argv the TestNG command line parameters. */ public static void main(String[] argv) { TestNG testng = privateMain(argv, null); System.exit(testng.getStatus()); }
@Test(description = "GITHUB-1810") public void ensureNoNullPointerExceptionIsThrown() throws IOException { TestNG testng = TestNG.privateMain(new String[] {createTemporarySuiteAndGetItsPath()}, null); assertThat(testng.getStatus()).isEqualTo(8); }
@Test(dataProvider = "getData") public void testMethod(Class<?> clazz, int expectedStatus) { TestNG testNG = create(clazz); testNG.run(); Assert.assertEquals(testNG.getStatus(), expectedStatus); }
@Test public void exitsWithZeroOnSuccess() { TestNG tng = create(ImmediateSuccess.class); tng.run(); assertEquals(tng.getStatus(), 0); }
@Test public void exitsWithNonzeroOnFailure() { TestNG tng = create(PersistentFailure.class); tng.run(); assertTrue(tng.getStatus() != 0); }
@Test(description = "GITHUB-217") public void exitWithNonzeroOnSkips1() { TestNG tng = create(Issue217TestClassSampleWithOneDataProvider.class); tng.run(); assertEquals(tng.getStatus(), 2); }
@Test public void testMainMethodExclusion() { TestNG tng = create(TestClassSample.class); tng.run(); Assert.assertEquals(tng.getStatus(), 0); }
@Test(description = "GITHUB-217") public void exitWithNonzeroOnSkips() { TestNG tng = create(Issue217TestClassSample.class); tng.run(); assertEquals(tng.getStatus(), 2); }
@Test(dataProvider = "dp") public void testMethod(Class<?> clazz) { TestNG testNG = create(clazz); testNG.setParallel(XmlSuite.ParallelMode.METHODS); testNG.run(); assertThat(testNG.getStatus()).isEqualTo(0); }
@Test(priority = 1) public void verifyWithoutListener() { TestNG testNG = create(); testNG.setTestSuites(Collections.singletonList(getPathToResource("test/listeners/github1284/github1284_nolistener.xml"))); testNG.run(); Assert.assertEquals(testNG.getStatus(), 0); }
@Test(priority = 3) public void verifyWithChildSuite() { TestNG testNG = create(); testNG.setTestSuites(Collections.singletonList(getPathToResource("test/listeners/github1284/github1284.xml"))); testNG.run(); Assert.assertEquals(testNG.getStatus(), 0); }
@Test(priority = 2) public void verifyWithListener() { TestNG testNG = create(); testNG.setTestSuites(Collections.singletonList(getPathToResource("test/listeners/github1284/github1284_withlistener.xml"))); testNG.run(); Assert.assertEquals(testNG.getStatus(), 0); }
@Test public void exitsWithZeroAfterSuccessfulRetry() { TestNG tng = create(EventualSuccess.class); tng.addListener((ITestNGListener) new TestResultPruner()); tng.run(); assertEquals(tng.getStatus(), 0); }
@Test public void testMainMethodExclusionForJunit() { XmlSuite xmlSuite = createXmlSuite("suite"); xmlSuite.setJunit(true); createXmlTest(xmlSuite, "test", JUnitTestClassSample.class); TestNG tng = create(xmlSuite); tng.run(); Assert.assertEquals(tng.getStatus(), 0); } }
public int getStatus() { return testng.getStatus(); }