Skip to content

Bisnode/opa-test-result-formatter

Repository files navigation

opa-test-result-formatter

Maven Central build

Single-purpose library to help transform the output of opa test into different formats, like JUnit XML or opa test -v summary.

Prerequisites

  • Java 8 or higher

Using the library

Gradle

Maven Central

implementation("com.bisnode.opa:opa-test-result-formatter:{version}")

Maven

Maven Central

<dependency>
    <groupId>com.bisnode.opa</groupId>
    <artifactId>opa-test-result-formatter</artifactId>
    <version>{version}</version>
</dependency>

Converting to JUnit XML

String testResultsJson = "..."; // output of opa test --format=json
OpaTestResults testResults = OpaTestResults.fromJson(testResultsJson);
JUnitXml junitXml = JUnitXML.from(testResults);

Converting to opa test -v format

String testResultsJson = "..."; // output of opa test --format=json
OpaTestResults testResults = OpaTestResults.fromJson(testResultsJson);
OpaVerboseSummary opaVerboseSummary = OpaVerboseSummary.of(testResults);
String summary = opaVerboseSummary.summary();

Made with ❤️ @ Bisnode