Search in sources :

Example 11 with TestNG

use of org.testng.TestNG in project pinot by linkedin.

the class HybridScanBasedCommandLineTestRunner method main.

public static void main(String[] args) throws Exception {
    if (args.length == 0) {
        usage();
    }
    int expectedArgsLen = 5;
    int ix = 0;
    // Parse optional arguments first.
    while (args[ix].startsWith("-")) {
        if (args[ix].equals("--record")) {
            CustomHybridClusterScanComparisonIntegrationTest._recordScanResponses = true;
        } else if (args[ix].equals("--llc")) {
            CustomHybridClusterScanComparisonIntegrationTest._useLlc = true;
        } else {
            usage();
        }
        ix++;
        expectedArgsLen++;
    }
    if (args.length != expectedArgsLen) {
        usage();
    }
    final String tableName = args[ix++];
    final String schemaFilePath = args[ix++];
    // we expect a dir called 'avro-files' and files called 'queries.txt' and 'scan-responses.txt' in here
    final String segQueryDirPath = args[ix++];
    final String invIndexCols = args[ix++];
    final String sortedCol = args[ix++];
    CustomHybridClusterScanComparisonIntegrationTest.setParams(tableName, schemaFilePath, segQueryDirPath, invIndexCols, sortedCol);
    TestListenerAdapter tla = new TestListenerAdapter();
    TestNG testng = new TestNG();
    testng.setTestClasses(new Class[] { CustomHybridClusterScanComparisonIntegrationTest.class });
    testng.addListener(tla);
    testng.run();
    System.out.println("Passed tests: " + tla.getPassedTests());
    if (!tla.getSkippedTests().isEmpty()) {
        System.out.println("Skipped tests: " + tla.getSkippedTests());
    }
    System.out.println(tla.toString());
    if (!tla.getFailedTests().isEmpty()) {
        System.err.println("Failed tests:" + tla.getFailedTests());
        System.exit(1);
    }
    System.exit(0);
}
Also used : TestNG(org.testng.TestNG) TestListenerAdapter(org.testng.TestListenerAdapter)

Example 12 with TestNG

use of org.testng.TestNG in project powermock by powermock.

the class GitHub647 method testSkipTest.

@Test
public void testSkipTest() throws Exception {
    final TestNG tng = createTestNG();
    runTest(tng);
    assertOneTestSkipped();
}
Also used : TestNG(org.testng.TestNG) SimpleBaseTest(samples.testng.SimpleBaseTest) Test(org.testng.annotations.Test)

Example 13 with TestNG

use of org.testng.TestNG in project powermock by powermock.

the class SimpleBaseTest method create.

public static TestNG create() {
    TestNG result = new TestNG();
    result.setUseDefaultListeners(false);
    result.setVerbose(0);
    return result;
}
Also used : TestNG(org.testng.TestNG)

Example 14 with TestNG

use of org.testng.TestNG in project mockito by mockito.

the class TestNGShouldFailWhenMockitoListenerFailsTest method report_failure_on_incorrect_stubbing_syntax_with_matchers_in_test_methods.

@Test
public void report_failure_on_incorrect_stubbing_syntax_with_matchers_in_test_methods() throws Exception {
    TestNG testNG = new_TestNG_with_failure_recorder_for(FailingOnPurposeBecauseIncorrectStubbingSyntax.class);
    testNG.run();
    assertTrue(testNG.hasFailure());
    assertThat(failureRecorder.lastThrowable()).isInstanceOf(InvalidUseOfMatchersException.class);
}
Also used : TestNG(org.testng.TestNG) Test(org.testng.annotations.Test)

Example 15 with TestNG

use of org.testng.TestNG in project spring-framework by spring-projects.

the class FailingBeforeAndAfterMethodsTestNGTests method runTestAndAssertCounters.

@Test
@Ignore("Fails against TestNG 6.11")
public void runTestAndAssertCounters() throws Exception {
    TrackingTestNGTestListener listener = new TrackingTestNGTestListener();
    TestNG testNG = new TestNG();
    testNG.addListener((ITestNGListener) listener);
    testNG.setTestClasses(new Class<?>[] { this.clazz });
    testNG.setVerbose(0);
    testNG.run();
    String name = this.clazz.getSimpleName();
    assertEquals("tests started for [" + name + "] ==> ", this.expectedTestStartCount, listener.testStartCount);
    assertEquals("successful tests for [" + name + "] ==> ", this.expectedTestSuccessCount, listener.testSuccessCount);
    assertEquals("failed tests for [" + name + "] ==> ", this.expectedFailureCount, listener.testFailureCount);
    assertEquals("failed configurations for [" + name + "] ==> ", this.expectedFailedConfigurationsCount, listener.failedConfigurationsCount);
}
Also used : TrackingTestNGTestListener(org.springframework.test.context.testng.TrackingTestNGTestListener) TestNG(org.testng.TestNG) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

TestNG (org.testng.TestNG)18 Test (org.testng.annotations.Test)5 TrackingTestNGTestListener (org.springframework.test.context.testng.TrackingTestNGTestListener)2 TestListenerAdapter (org.testng.TestListenerAdapter)2 BeforeClass (org.testng.annotations.BeforeClass)2 IOException (java.io.IOException)1 InetAddress (java.net.InetAddress)1 MalformedURLException (java.net.MalformedURLException)1 UnknownHostException (java.net.UnknownHostException)1 ArrayList (java.util.ArrayList)1 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)1 GradleException (org.gradle.api.GradleException)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 ITestListener (org.testng.ITestListener)1 SimpleBaseTest (samples.testng.SimpleBaseTest)1