/lib-systemtest

An assertion library to test processes or main() on the JVM.

Primary LanguageJavaMIT LicenseMIT

lib-systemtest

A library to test JVM functions and programs behavior on System.out, System.err, and System.exit().

GitHub CI/CD

Target Audience

  • Developers of command line tools on the JVM.
  • Teachers and Students that work on JVM languages and want to verify assignments that operate on System.out.
  • Trainers of Test-Driven Development.

Dependencies/Requirements

  • Java 8 JRE
  • The library depends on the JUnit5 API but should work quite well also with TestNG or Cucumber.

It has been developed in Java, but should also work quite nicely in other JVM-languages like Kotlin, Groovy, Scala, and Clojure.

Example

import org.junit.jupiter.api.Test;
import static com.nelkinda.systemassert.SystemAssertions.assertProc;

class HelloTest {
    @Test
    void printsHelloWorld() {
        assertProc(Hello::main)
                .hadStdout("Hello, world!\n")
                .hadStderr("")
                .withSuccess();
    }
}

Reports

The reports are available locally, after running a build using make pipeline

lib-systemassert

examples