This message was deleted.
# develocity
s
This message was deleted.
j
Looking at other Test task such as C++ tests, it does not look as if it would be supported easily. But I hope someone with deeper insight in Gradle internal have some ideas for me. @Daz DeBoer perhaps you have any thoughts on this?
I have my task extending AbstractTestTask but scan shows: 0 tests executed This build did not execute any tests.
e
Hello. We've been given access to a beta with a way of importing JUnit XML formatted test results into Gradle Enterprise and we implemented it with great success on C# NUnit or VSTest files, along with Jest and Jasmine on the nodeJS side. All you have to do is to transform the results from the runner you are using into JUnit, and then add the appropriate declarations.
j
Thanks, that sounds interesting, a concern is that all of this is legacy code and a very old Gradle version. Results are already there since many years: "We run a command line tool that generates JUnit compatible test result files" so that should be an easy task. I was just digging into the TestResultProcessor which I think may be a key here in case I want to go the long route. I saw @melix has some history in that file.
I am already running the test from a TestExecuter, so I just need a short guide in how to correctly call the TestResultProcessor - I think 😄 Looks kind of straightforward but is a completed() called even after a failure() is called? And shall output always be called? Hint to add javadoc to these calls.
m
@Jocce Nilsson
TestResultProcessor
is an internal API hence the lack of Javadoc. 😉
Looks kind of straightforward but is a completed() called even after a failure() is called?
Yes
👍 1
The JUnit XML import feature (in private beta) requires Gradle 5.3. Which version are you on?
j
5.6.5
Would TestResultProcessor calls be enough to register the tests in G.E.?
In that case, I am pretty close to done. Just some small coding and testing tasks left.
m
Would TestResultProcessor calls be enough to register the tests in G.E.?
They should be as long as you’re “doing it right”. However, we can’t provide official support for that, i.e. ensure it doesn’t break in future versions.
j
I see, using an internal API may not be the best. Luckily it is legacy code and no major steps are planned for it. The new tests are all running with JUnit5 and some internal extensions
👍 1
Thanks @Marc Philipp, now I know I am on the right path!
m
You’re welcome!
j
I am still struggling a bit on which calls to actually make in order to propagate details to G.E. My first attempt was to make calls to only:
Copy code
testResultProcessor.started() //test case
testResultProcessor.completed() //test case
But that failed to be registered even if the code ran fine. I also tried adding
Copy code
testResultProcessor.started() //test suite
testResultProcessor.started() //test case
testResultProcessor.completed() //test case
testResultProcessor.completed() //test suite
but that failed on the final 'completed' with
java.lang.IllegalStateException: This operation (org.gradle.api.internal.tasks.testing.logging.TestCountLogger - Run tests) has already been completed.
Since it is internal, I understand that there is no guide in which order and details that are to be used.
d
@Jocce Nilsson As Emmanuel mentioned earlier in this thread, Gradle has developed a (as yet undocumented) beta feature that allows test results from JUnit XML files to be "uploaded" to a Build Scan.
Since I don't have any publicly accessible documentation I can link, can you please file a Gradle Enterprise support request asking about this?
👍 1
j
ticket is up, 4101
and thanks!
no hurry, it's Saturday after all 🙂
d
I just replied with the docs for the Beta.
👍 1
j
Too bad... this code that I am trying is a hack to get our legacy integration tests registered. All new tests are migrated to a new framework based on JUnit5 already. In legacy versions we are at most on gradle 5.6.5 with "com.gradle.build-scan" version "3.8.1". GE Current version: 2021.4.2 so that one is safe
m
It should work with Gradle 5.6.5 and
com.gradle.build-scan
3.8.1. Is that unclear from the document?
j
Alright, it states Gradle enterprise plugin, not build scan plugin. But if you think it works then I will give it a try. Thanks!
Works just fine. Awesome!!!
m
I’ll update our docs to clarify that. Thanks for the feedback!
👍 1
d
Glad it's working for you @Jocce Nilsson
j
Thanks! Almost at least... we are using a custom/local version or JUnit XML, so there are some compatibility issues. Jenkins was able to read it but seems we are missing the stacktrace node so the importer fails. It is enough to get us started as the scans are now showing the result at least, then we can improve it later to include the error and the logs.
d
Yes, there's no real schema or standard for JUnit XML files, and we added the concept of a "dialect" to handle different variations. Are you able to share a sample of your JUnit XML file? (DM is fine) We try to make our
GENERIC
dialect work with as many external tools as possible.
j
sure