Generate and convert JUnit tests report for xunit-viewer
This commit is contained in:
parent
7f2ab7ff92
commit
80d0960c4d
2 changed files with 33 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
|
bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.5
|
||||||
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10
|
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10
|
||||||
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.2.3
|
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.2.3
|
||||||
bld.extension-tests=com.uwyn.rife2:bld-tests-badge:1.4.6
|
bld.extension-tests=com.uwyn.rife2:bld-tests-badge:1.4.6
|
||||||
|
|
|
@ -19,6 +19,7 @@ package rife.render;
|
||||||
|
|
||||||
import rife.bld.BuildCommand;
|
import rife.bld.BuildCommand;
|
||||||
import rife.bld.Project;
|
import rife.bld.Project;
|
||||||
|
import rife.bld.extension.ExecOperation;
|
||||||
import rife.bld.extension.JacocoReportOperation;
|
import rife.bld.extension.JacocoReportOperation;
|
||||||
import rife.bld.extension.PmdOperation;
|
import rife.bld.extension.PmdOperation;
|
||||||
import rife.bld.extension.TestsBadgeOperation;
|
import rife.bld.extension.TestsBadgeOperation;
|
||||||
|
@ -27,6 +28,9 @@ import rife.bld.publish.PublishInfo;
|
||||||
import rife.bld.publish.PublishLicense;
|
import rife.bld.publish.PublishLicense;
|
||||||
import rife.bld.publish.PublishScm;
|
import rife.bld.publish.PublishScm;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static rife.bld.dependencies.Repository.*;
|
import static rife.bld.dependencies.Repository.*;
|
||||||
|
@ -116,10 +120,36 @@ public class TemplateRenderersBuild extends Project {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
testsBadgeOperation.executeOnce(() -> testsBadgeOperation
|
var testResultsDir = "build/test-results/test/";
|
||||||
|
|
||||||
|
var op = testsBadgeOperation
|
||||||
.url(property("testsBadgeUrl"))
|
.url(property("testsBadgeUrl"))
|
||||||
.apiKey(property("testsBadgeApiKey"))
|
.apiKey(property("testsBadgeApiKey"))
|
||||||
.fromProject(this));
|
.fromProject(this);
|
||||||
|
op.testToolOptions().reportsDir(new File(testResultsDir));
|
||||||
|
op.execute();
|
||||||
|
|
||||||
|
var xunitViewer = new File("/usr/bin/xunit-viewer");
|
||||||
|
if (xunitViewer.exists() && xunitViewer.canExecute()) {
|
||||||
|
var reportsDir = "build/reports/tests/test/";
|
||||||
|
|
||||||
|
var iconv = new File("/usr/bin/iconv");
|
||||||
|
if (iconv.exists() && iconv.canExecute()) {
|
||||||
|
var junitTestResults = new File(testResultsDir, "TEST-junit-jupiter.xml").getPath();
|
||||||
|
new ExecOperation()
|
||||||
|
.fromProject(this)
|
||||||
|
.command("iconv", "-f", "CP1250", "-t", "UTF8", "-o", junitTestResults, junitTestResults)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
Files.createDirectories(Path.of(reportsDir));
|
||||||
|
|
||||||
|
new ExecOperation()
|
||||||
|
.fromProject(this)
|
||||||
|
.command(xunitViewer.getPath(), "-r", testResultsDir, "-o", reportsDir + "index.html")
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue