Generate and convert JUnit reports for xunit-viewer
This commit is contained in:
parent
95df2d5838
commit
9f9fdac82e
1 changed files with 32 additions and 3 deletions
|
@ -23,6 +23,9 @@ import rife.bld.publish.PublishDeveloper;
|
|||
import rife.bld.publish.PublishLicense;
|
||||
import rife.bld.publish.PublishScm;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
import static rife.bld.dependencies.Repository.*;
|
||||
|
@ -34,13 +37,13 @@ public class JacocoReportOperationBuild extends Project {
|
|||
public JacocoReportOperationBuild() {
|
||||
pkg = "rife.bld.extension";
|
||||
name = "JacocoReportOperation";
|
||||
version = version(0, 9, 10);
|
||||
version = version(0, 9, 11, "SNAPSHOT");
|
||||
|
||||
javaRelease = 17;
|
||||
|
||||
downloadSources = true;
|
||||
autoDownloadPurge = true;
|
||||
|
||||
|
||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
|
||||
|
||||
var jacocoVersion = new VersionNumber(0, 8, 13);
|
||||
|
@ -107,6 +110,32 @@ public class JacocoReportOperationBuild extends Project {
|
|||
.command("scripts/cliargs.sh")
|
||||
.execute();
|
||||
}
|
||||
super.test();
|
||||
|
||||
var testResultsDir = "build/test-results/test/";
|
||||
var op = testOperation().fromProject(this);
|
||||
op.testToolOptions().reportsDir(new File(testResultsDir));
|
||||
|
||||
Exception ex = null;
|
||||
try {
|
||||
op.execute();
|
||||
} catch (Exception e) {
|
||||
ex = e;
|
||||
}
|
||||
|
||||
var xunitViewer = new File("/usr/bin/xunit-viewer");
|
||||
if (xunitViewer.exists() && xunitViewer.canExecute()) {
|
||||
var reportsDir = "build/reports/tests/test/";
|
||||
|
||||
Files.createDirectories(Path.of(reportsDir));
|
||||
|
||||
new ExecOperation()
|
||||
.fromProject(this)
|
||||
.command(xunitViewer.getPath(), "-r", testResultsDir, "-o", reportsDir + "index.html")
|
||||
.execute();
|
||||
}
|
||||
|
||||
if (ex != null) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue