Hello, I'm trying to use `ImportJUnitXmlReports` t...
# develocity
t
Hello, I'm trying to use
ImportJUnitXmlReports
to ingest some Nunit tests. I feel like I'm almost there: • the junit.xml report is created • the task finalizer sees it (checked in debug + there is no
No JUnit XML reports found in any of the declared inputs!
warning) • but still my build scan is published without any test result Any idea why or what to investigate here ?
n
Can you share your configuration of the
ImportJUnitXmlReports
task?
t
I'm basically using the static helper on my test task
Copy code
ImportJUnitXmlReports.register(tasks, testMsbuildTask, GENERIC)
and the test task declares the correct junit report directory as an ouptut
Copy code
outputs.dir(junitReportDir)
and when I debug into
ImportJUnitXmlReports
I can see it the report file is listed in
xmlFiles
(GE 3.7.2) in this piece of code:
Copy code
xmlFiles.stream().map((xml) -> {
    return new ImportJUnitXmlReports.a(xml.getAbsoluteFile(), referenceTaskIdentity, dialect);
}).forEach(this::emitEvent);
n
hmm, here are some troubleshooting questions: In the build scan, do you see that a finalizer was added to the test task? Do you see the
ImportJunitXmlReport
task executed? What is the contents of
junitReportDir
?
t
Yes the finalizer was added to the test task and was executed.
junitReportDir
is set to
${buildDir}/junit
I made some progress tweaking how I import gradle enterprise. I now have
Copy code
There was an error while importing the JUnit XML
java.lang.NullPointerException
        at com.gradle.junit.xml.streaming.parser.h.e(SourceFile:307)
        at com.gradle.junit.xml.streaming.parser.h.f(SourceFile:100)
        at com.gradle.junit.xml.streaming.parser.g.a(SourceFile:56)
        at com.gradle.junit.xml.streaming.parser.g.a(SourceFile:33)
        at com.gradle.scan.plugin.internal.b.v.e.a(SourceFile:48)
        at com.gradle.scan.plugin.internal.l.a$b.a(SourceFile:108)
        at com.gradle.scan.plugin.internal.l.a$b.progress(SourceFile:98)
        at com.gradle.scan.plugin.internal.l.a.a(SourceFile:60)
        at com.gradle.scan.plugin.internal.l.l.a(SourceFile:42)
        at com.gradle.scan.plugin.internal.l.c.a(SourceFile:84)
        at com.gradle.scan.plugin.internal.l.g.a(SourceFile:45)
        at com.gradle.scan.plugin.internal.q.a$a.a(SourceFile:31)
        at com.gradle.scan.plugin.internal.q.a$a.a(SourceFile:20)
        at com.gradle.scan.plugin.internal.q.a.c(SourceFile:67)
        at java.lang.Thread.run(Thread.java:748)
I'll try to inject a fake JUnit result from a JVM Junit result
Ok it worked with my fake Junit report. So my generated Junit report format is wrong. Any idea on how to explicit this exception ?
Looks like
timestamp
field on
testsuite
is considered required by the Gradle Junit XML parser.
n
hmm, @Eric Wendelin might be the guy to talk to here
e
Hi @teikiteetini-vaysse Loic. You are correct.
timestamp
information from tests are necessary to translate the JUnit XML into the Gradle Enterprise tests model. Which test runner are you using that generates JUnit XML without this timestamp information?
t
I'm running C# tests using dotnet vstest. We have thousands of tests projects so to speed up things, I'm trying to factor the work through our MSBuild plugin by using XLS transformations. Here is the xls https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/xunit/types/mstest-1.0-to-junit-1.0.xsl. This is the same that we use in Jenkins to transform TRX into JUnit so that it can be displayed.
Hello @Eric Wendelin, I'm hitting the same kind of null pointer exception. As the code is offustacted, could you tell me what is missing please ?
Copy code
There was an error while importing the JUnit XML
java.lang.NullPointerException
        at com.gradle.enterprise.a.a.b(SourceFile:23)
        at com.gradle.junit.xml.streaming.parser.h.b(SourceFile:291)
        at com.gradle.junit.xml.streaming.parser.h.f(SourceFile:138)
        at com.gradle.junit.xml.streaming.parser.g.a(SourceFile:56)
        at com.gradle.junit.xml.streaming.parser.g.a(SourceFile:33)
        at com.gradle.scan.plugin.internal.b.v.e.a(SourceFile:48)
        at com.gradle.scan.plugin.internal.l.a$b.a(SourceFile:108)
        at com.gradle.scan.plugin.internal.l.a$b.progress(SourceFile:98)
        at com.gradle.scan.plugin.internal.l.a.a(SourceFile:60)
        at com.gradle.scan.plugin.internal.l.l.a(SourceFile:42)
        at com.gradle.scan.plugin.internal.l.c.a(SourceFile:84)
        at com.gradle.scan.plugin.internal.l.g.a(SourceFile:45)
        at com.gradle.scan.plugin.internal.q.a$a.a(SourceFile:31)
        at com.gradle.scan.plugin.internal.q.a$a.a(SourceFile:20)
        at com.gradle.scan.plugin.internal.q.a.c(SourceFile:67)
        at java.lang.Thread.run(Thread.java:748)
e
Heyo, I ran out of time on this today but will follow up tomorrow.
t
Hello @Eric Wendelin, any chance you could have a look at this please ?
found it, time is always required for test cases
e
Ah, I'm sorry for not clarifying that earlier. Timing information is very important for the data model. All working now?
t
Yup working now. It was very frustrating that it's not clear what's missing. Neither in the logs, nor in the stacktrace and this is unfortunately not documented. time and timestamps are not always required in JUnit format. Here time was missing on a skipped test.
e
Thanks for the feedback. I've made a note to ensure this is fully documented before we make it public beta or GA.