kwenza-test(1)
DESCRIPTION
Builds the project (see kwenza-build(1)), compiles src/test/java to
<output-dir>/test-classes, copies src/test/resources alongside it if that directory exists,
and runs the tests with the JUnit Platform Console Launcher in a new java process. Its
classpath has the main and test classes and every resolved jar, from both [dependencies] and
[dev-dependencies].
The launcher comes from a dev-dependency: add
org.junit.platform:junit-platform-console-standalone, which bundles it with every JUnit engine
(see Manifest Reference). kwenza doesn’t care which JUnit Platform
engine runs the tests: Jupiter, Vintage, or a third-party one such as TestNG’s, found on the
classpath by the launcher itself.
If org.mockito:mockito-core resolves, kwenza loads it as a -javaagent on the test process,
so Mockito doesn’t have to attach itself at runtime, which JDK 21 and later warn about.
Tests run in their own process, never inside kwenza’s, so a test calling System.exit() can’t
take kwenza down with it.
With no compiled test classes (no src/test/java, or nothing in it), kwenza test prints
test: no tests found and succeeds. Test classes with no dev-dependency providing the launcher
is a misconfiguration, and fails with a message naming the dependency to add.
The launcher’s own report goes straight to standard output; kwenza doesn’t reformat it.
OPTIONS
ENVIRONMENT
See kwenza(1) for the environment variables kwenza reads.
EXIT STATUS
-
0: every test passed, or there were no tests. -
1: kwenza failed before running the tests, for example because compilation failed; the error message says what and how. -
2: the command line was invalid: an unknown command or option. -
101: kwenza hit a bug in itself. Please report it, with the output of--verbose. -
Anything else: the test launcher’s own exit code, passed through unchanged.
The JUnit console launcher exits with 1 when a test fails, the same code as kwenza’s own errors.
kwenza tells them apart for you: its own failures print an error: line, failing tests print
test: failed (exit 1) after the launcher’s report.
EXAMPLES
Run every test:
kwenza test
Recompile from scratch and run the tests, showing which engines ran:
kwenza clean test --verbose