bld-testng/README.md

1.9 KiB

Bld Extension to Run Tests with TestNG

License Java Release Snapshot GitHub CI

To run the tests with TestNG:

@BuildCommand(summary = "Run tests with TestNG")
public void testng() throws Exception {
    new TestNgOperation()
    .fromProject(this)
    .packages("com.example")
    .execute();
}
./bld compile testng

You could also override the default test command:

@BuildCommand(summary = "Run tests with TestNG")
public void test throws Exception {
    new TestNgOperation()
    .fromProject(this)
    .suites("src/test/resources/testng.xml")
    .verbose(2)
    .execute();
}
./bld compile test

Please check the TestNgOperation documentation for all available configuration options.

TestNG Dependency

Don't forget to add a TestNG test dependency to your build file, as it is not provided by the extension. For example:

repositories = List.of(MAVEN_CENTRAL);
scope(test).include(dependency("org.testng", "testng", version(7, 8, 0)));