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
Test that has a build error, does not fail the junit-report #46
Comments
If you only care about the non zero exit code when the test doesn't compile, you could also try to compile the test before running it. For example: $ go test -c -o test.out && ./test.out --test.v | go-junit-report; echo $? I'm not entirely convinced yet whether this case should be supported, as it seems like a lot of extra code just to set the exit code. Have you maybe thought about capturing the error message and making it available in the report (and how would that be represented in the junit format)? |
Hey, thanks for the feedback. As for the command line solution:
By leaving the go-junit-report as it is, it's return code might be wrong in some of the cases, and thus his behavior is not as expected. It might be a lot of extra code (I'm not sure, it is a lot of tests code). If you have any advice how to implement it in a more simple way, I'll be glad to rewrite it. About the output junit, Cheers |
When you run As for the error in the report, I got the impression from the discussion in #41 that the JUnit spec doesn't support testsuite-level failures. The errors attribute that you mention contains the number of failing tests in the testsuite AFAIK. |
As for the time: if the build fails, then you are right, it won't take longer. but if it doesn't, then the test time will be the time of As for the report, It looks like that testuite does have an |
Actually, when you run Does the workaround I proposed not work in your case? I'd expect that most people use this tool in an automated way that only needs to be setup once. |
I agree with @posener in that you want the usage to remain the same in order to detect build failures. Additionally, when running tests for multiple packages at once, you can't specify the -c flag, so in my case, where I want to use go-junit-report like |
I hadn't considered that case @MicahLC, thanks. Do you have any thoughts how these errors should be included in the XML report that is generated? |
Not particularly, I don't know much about the XML format. As long as it shows up as a failure at a high level (e.g. when Jenkins picks it up), I'll be happy :) |
Just hit this case described by MicahLC as well. Our branches are happily green in bamboo a PR got merged which actually broke the build. Error reporting was masked. |
@jstemmer and @posener : I've looked at the XML linked in @posener's last comment on Feb 16th, and I agree that the build failure should be reported in the "errors" attribute on the "testsuite". You might need to also increase the number of "tests" in the "testsuite" to 1 in that case; I'm not sure how JUnit would respond if you tell it there were no tests but 1 test had an error. Thoughts? It'd be great to get this resolved and pulled in soon. It sounds like more and more people are broken by this issue. |
I wasn't entirely sure if the approach in #45 was the right way to deal with it and given I was quite busy at the time neglected this for a while, sorry for that. After giving it some more thought, I do believe this is something we should handle right. It looks like the junit spec was created purely for testing, so AFAIK it doesn't have a good way of dealing with build errors (or even the case described in #41). We can work around it by declaring a fake test in the report called for example I'll leave some comments on #45 and we should be able to make this work and get it merged. |
Remove maven repository from user-report test
The output of a test that failed on build might be:
running the go-junit-report on that test with the flag
-set-exit-code
still returns exit code 0.The text was updated successfully, but these errors were encountered: