Get failing tests related to a maven build in a pipeline script?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Get failing tests related to a maven build in a pipeline script?

Vincent Massol
Hi guys,

I know how to get the failing tests for a job with:

AbstractTestResultAction testResultAction = currentBuild.rawBuild.getAction(AbstractTestResultAction.class)
def failedTests = testResultAction.getResult().getFailedTests()

However, my pipeline job is executing Maven several times. 

Is there a simple way to do this or do I need to save the failing tests in a variable after each maven execution to compute the new failing tests?

Thanks
-Vincent


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/115d5de6-17dd-4e2a-bedf-21cbe787dfb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Get failing tests related to a maven build in a pipeline script?

Victor Martinez
What about this: https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ ? Not sure whether the failureDiffString method might help you in this case.

Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2cbea256-68fe-4bed-9543-125930fee124%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Get failing tests related to a maven build in a pipeline script?

Vincent Massol
Thanks Victor. Not sure how failureDiffString would help. The issue is that this returns the failures from all past maven executions and not just for the last run.

FTM I've done this but it's overly complex and it would be nice to be able to get the failed tests related only to the last maven execution:
https://github.com/xwiki/xwiki-jenkins-pipeline/commit/cd1ed55e12b22f3957ee1a6e099686461886350b

Note that I have to go through a global env variable to save the previous state and compare.

Thanks
-Vincent

On Tuesday, January 30, 2018 at 6:08:13 PM UTC+1, Victor Martinez wrote:
What about this: <a href="https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ&#39;;return true;">https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ ? Not sure whether the failureDiffString method might help you in this case.

Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1cc31109-1567-44d5-b512-2fffb35c6160%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Get failing tests related to a maven build in a pipeline script?

Vincent Massol
Actually my code won't work. Just realized that 'env' can only store Strings. Thus I need a way to have some global variable shared between calls to my scripted pipeline library... Any idea?

On Tuesday, January 30, 2018 at 6:15:20 PM UTC+1, Vincent Massol wrote:
Thanks Victor. Not sure how failureDiffString would help. The issue is that this returns the failures from all past maven executions and not just for the last run.

FTM I've done this but it's overly complex and it would be nice to be able to get the failed tests related only to the last maven execution:
<a href="https://github.com/xwiki/xwiki-jenkins-pipeline/commit/cd1ed55e12b22f3957ee1a6e099686461886350b" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fxwiki%2Fxwiki-jenkins-pipeline%2Fcommit%2Fcd1ed55e12b22f3957ee1a6e099686461886350b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEs91Oeh0yGwj3MhSsxYkOfPyg26Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fxwiki%2Fxwiki-jenkins-pipeline%2Fcommit%2Fcd1ed55e12b22f3957ee1a6e099686461886350b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEs91Oeh0yGwj3MhSsxYkOfPyg26Q&#39;;return true;">https://github.com/xwiki/xwiki-jenkins-pipeline/commit/cd1ed55e12b22f3957ee1a6e099686461886350b

Note that I have to go through a global env variable to save the previous state and compare.

Thanks
-Vincent

On Tuesday, January 30, 2018 at 6:08:13 PM UTC+1, Victor Martinez wrote:
What about this: <a href="https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ&#39;;return true;">https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ ? Not sure whether the failureDiffString method might help you in this case.

Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8517696e-b987-438a-8cb8-663cb4327768%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Get failing tests related to a maven build in a pipeline script?

Vincent Massol
And the solution is simpler, I just need to save the failing tests before the maven execution and compare with the full list of failing tests I get after that maven execution:
https://github.com/xwiki/xwiki-jenkins-pipeline/commit/1bce23c511fa04a1b26ae012f198c9b99049a100

Thanks
-Vincent

On Wednesday, January 31, 2018 at 7:19:39 AM UTC+1, Vincent Massol wrote:
Actually my code won't work. Just realized that 'env' can only store Strings. Thus I need a way to have some global variable shared between calls to my scripted pipeline library... Any idea?

On Tuesday, January 30, 2018 at 6:15:20 PM UTC+1, Vincent Massol wrote:
Thanks Victor. Not sure how failureDiffString would help. The issue is that this returns the failures from all past maven executions and not just for the last run.

FTM I've done this but it's overly complex and it would be nice to be able to get the failed tests related only to the last maven execution:
<a href="https://github.com/xwiki/xwiki-jenkins-pipeline/commit/cd1ed55e12b22f3957ee1a6e099686461886350b" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fxwiki%2Fxwiki-jenkins-pipeline%2Fcommit%2Fcd1ed55e12b22f3957ee1a6e099686461886350b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEs91Oeh0yGwj3MhSsxYkOfPyg26Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fxwiki%2Fxwiki-jenkins-pipeline%2Fcommit%2Fcd1ed55e12b22f3957ee1a6e099686461886350b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEs91Oeh0yGwj3MhSsxYkOfPyg26Q&#39;;return true;">https://github.com/xwiki/xwiki-jenkins-pipeline/commit/cd1ed55e12b22f3957ee1a6e099686461886350b

Note that I have to go through a global env variable to save the previous state and compare.

Thanks
-Vincent

On Tuesday, January 30, 2018 at 6:08:13 PM UTC+1, Victor Martinez wrote:
What about this: <a href="https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ&#39;;return true;">https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ ? Not sure whether the failureDiffString method might help you in this case.

Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/93ea2888-f670-4b8d-9402-44541c4d9702%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Get failing tests related to a maven build in a pipeline script?

Vincent Massol
Well, it doesn't work...

The issue is because we use parallel() step and thus we have several maven runs starting in parallel. So they start with empty failing tests but one of them can contribute failing tests to the others since all failing tests are accruing in currentBuild... :(

So I really need to find a way to identify how to get the failing tests for a given maven run...

Is there anything in CaseResult/TestResult would allow me to do this for example?

Any idea?

thanks
-Vincent

On Wednesday, January 31, 2018 at 11:54:24 AM UTC+1, Vincent Massol wrote:
And the solution is simpler, I just need to save the failing tests before the maven execution and compare with the full list of failing tests I get after that maven execution:
<a href="https://github.com/xwiki/xwiki-jenkins-pipeline/commit/1bce23c511fa04a1b26ae012f198c9b99049a100" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fxwiki%2Fxwiki-jenkins-pipeline%2Fcommit%2F1bce23c511fa04a1b26ae012f198c9b99049a100\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE05nvA2CAGgM1YDB76QSq1e3pjdg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fxwiki%2Fxwiki-jenkins-pipeline%2Fcommit%2F1bce23c511fa04a1b26ae012f198c9b99049a100\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE05nvA2CAGgM1YDB76QSq1e3pjdg&#39;;return true;">https://github.com/xwiki/xwiki-jenkins-pipeline/commit/1bce23c511fa04a1b26ae012f198c9b99049a100

Thanks
-Vincent

On Wednesday, January 31, 2018 at 7:19:39 AM UTC+1, Vincent Massol wrote:
Actually my code won't work. Just realized that 'env' can only store Strings. Thus I need a way to have some global variable shared between calls to my scripted pipeline library... Any idea?

On Tuesday, January 30, 2018 at 6:15:20 PM UTC+1, Vincent Massol wrote:
Thanks Victor. Not sure how failureDiffString would help. The issue is that this returns the failures from all past maven executions and not just for the last run.

FTM I've done this but it's overly complex and it would be nice to be able to get the failed tests related only to the last maven execution:
<a href="https://github.com/xwiki/xwiki-jenkins-pipeline/commit/cd1ed55e12b22f3957ee1a6e099686461886350b" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fxwiki%2Fxwiki-jenkins-pipeline%2Fcommit%2Fcd1ed55e12b22f3957ee1a6e099686461886350b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEs91Oeh0yGwj3MhSsxYkOfPyg26Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fxwiki%2Fxwiki-jenkins-pipeline%2Fcommit%2Fcd1ed55e12b22f3957ee1a6e099686461886350b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEs91Oeh0yGwj3MhSsxYkOfPyg26Q&#39;;return true;">https://github.com/xwiki/xwiki-jenkins-pipeline/commit/cd1ed55e12b22f3957ee1a6e099686461886350b

Note that I have to go through a global env variable to save the previous state and compare.

Thanks
-Vincent

On Tuesday, January 30, 2018 at 6:08:13 PM UTC+1, Victor Martinez wrote:
What about this: <a href="https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ&#39;;return true;">https://groups.google.com/d/msg/jenkinsci-dev/hI3aSyayYxQ/txGte6HQAAAJ ? Not sure whether the failureDiffString method might help you in this case.

Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f4a0b6f8-024e-4f81-bf0e-43cd4814d5d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.