-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add a custom test listener for usable JUnit XML reports #6313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Together with scala/scala-partest#95, this enables output like:
https://gist.github.com/ee32b258501b3c8fc698ddf74aa8d615 Which should, in turn, help us get a nice unified output from the Jenkins Junit Test report . |
@SethTisue I half remember discussing this goal with you on a ticket, but I can't seem to find it to cross reference. |
doesn't ring a bell... |
needs rebase |
build.sbt
Outdated
val trace: String = if (e.throwable.isDefined) { | ||
val stringWriter = new StringWriter() | ||
val writer = new PrintWriter(stringWriter) | ||
e.throwable.get.printStackTrace(writer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be processed further (as in https://github.com/sbt/junit-interface/blob/master/src/main/java/com/novocode/junit/RichLogger.java) or does the consumer of the log take care of that?
build.sbt
Outdated
// file on group of tests run by `testAll`, and the test names in the XML file don't seem to show the path to the | ||
// test for tests defined in a single file. | ||
// | ||
// Let's roll our own to try to enable the Jenkins JUnit test reports. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this still work on Travis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it looks like does not support anything other than plain text reports, which seems like a step backwards to me. We can install our own tooling on the Travis VM (Jenkins perhaps! Only 28% joking...) to render HTML reports and upload them to S3 and add a link to the text output.
/cc @adriaanm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not coming soon it seems travis-ci/travis-ci#239 - in any case, we're keeping CI validation on jenkins for now, travis only for releases.
build.sbt
Outdated
} else { | ||
"" | ||
} | ||
val result = <testsuite hostname={ delegate.hostname } name={ e.fullyQualifiedName()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make more sense to make pos
, neg
, etc. the test suites rather than reporting each individual test as one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, that would be an improvement. I'll see if I can rig that up.
d25ae2b
to
6d21300
Compare
@Stefan: I've had to make another change to partest to pass through the With that, and the changes just pushed here, I end up a file structure like:
Inside the files, I've added durations (although read them with a grain of salt as things are running in parallel), and stripped ANSI escape sequence from places it could show up. Failed tests get the transcript of partests steps, the checkfile diff and the exception stacktraces. I'm going to run the latest files through the Jenkins reporter to see how they look. |
- Update to partest that emits more detailed TestEvents - Group partest JUnit XML reports in, e.g, test.files.pos.xml - workaround Jenkins dislike of the work "run" Requires a new version of partest to provide some missing metadata. Sample files generated: ``` > ;partest --srcpath scaladoc --grep t7876; partest --grep default ... ``` ``` ⚡ (cd target/test/test-reports/partest && find . ) . ./test.files.jvm.xml ./test.files.neg.xml ./test.files.pos.xml ./test.files.presentation.xml ./test.files.run_.xml ./test.files.scalap.xml ./test.files.specialized.xml ./test.scaladoc.run_.xml ```
32b1d5f
to
8f96e5e
Compare
I've just released partest 1.1.5 via Sonatype, this should be buildable in an hour or two. |
/rebuild |
This is ready to go now. Results are in https://scala-ci.typesafe.com/job/scala-2.13.x-validate-main/260/testReport/ under "test.files" and "test.scaladoc" The remaining problem is that rendering of these pages is horrendously slow. Using https://scala-ci.typesafe.com/threadDump, I noticed:
I think this is looking back through the archives of previous builds to find the last result of each given test. This might become faster after we have our first build with the new partest XML test results in the build history. I'm testing this theory with a rebuild: https://scala-ci.typesafe.com/job/scala-2.13.x-validate-main/320/console Otherwise, there might be something unusual in the way we're mapping partest test cases to pseudo class name and method names that trigger an inefficiency here. |
The test result page rendering still isn't great but seems < 5s, so let's book the progress. |
Requires a new version of partest to provide some missing metadata.
Sample files generated: