It is working great... however only for about 1 hour. After that, any descriptions set by the postbuild script (e.g. someCaseResult.description = "Some Description") on a failed test vanish like they were never there. When I come back later I only see the option "Add description" instead of the previously set description.
I am now trying to see if this replicates with a description that I set manually on a failed test result, I will come back tomorrow with the results of this test.
Using Jenkins ver. 1.565.3 LTS.
Thanks, Eduard
Daniel Beck
unread,
Jan 6, 2015, 6:17:36 PM1/6/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jenkins...@googlegroups.com
Test results are stored in weak references to be discarded in case memory is required for something else. Builds themselves aren't kept in memory either. And the code you have does not persist test results to disk.
Something like the following should work (untested):
def result = manager.build.testResultAction.result
failedTests = result.getFailedTests()
// changes to tests in the result here
manager.build.testResultAction.setResult(result, manager.listener)
You can check whether it works by looking at the junitResult.xml file's modification date and contents and/or restarting Jenkins.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jenkins...@googlegroups.com
Hi,
It seems to make sense what you are saying, however, I can not get to an instance of TestResultAction.
I have tried many things and did a lot of printing to see what I am working with. Here is what I get for the following:
manager.build.getClass() --> class hudson.maven.MavenModuleSetBuild manager.build.testResultAction.getClass() --> class hudson.maven.reporters.SurefireAggregatedReport manager.build.aggregatedTestResultAction.getClass() --> class hudson.maven.reporters.SurefireAggregatedReport manager.build.getAction(hudson.tasks.junit.TestResultAction.class) --> null manager.build.getAction(hudson.tasks.test.AbstractTestResultAction.class) --> hudson.maven.reporters.SurefireAggregatedReport@bb1453 manager.build.testResultAction.result.getClass() --> class hudson.tasks.test.AggregatedTestResultAction$1 (assuming this one is ChildReport) manager.build.testResultAction.getResult().getClass() --> class hudson.tasks.test.AggregatedTestResultAction$1 (assuming this one is ChildReport)
So it seems that TestObjects are not persisted so I would have to use that protected method instead. AFAIK that works in Groovy, even if the method is persisted, so I tried the following, going from bottom-up this time:
For some reason, even if the setDescription menthod is supposed to set the description in the list of descriptions of the SurefireReport action (subclass of TestResultAction), the save method is not persisting the description in the build.xml file.
From setting the description manually, I can confirm that that is the place where it is supposed to be saved and that the SurefireReport action is the right one to use. Maybe I am not calling save() on the right instance?
I would really appreciate some help on this one since I am so close to finishing it and I have spent a lot of time going back and forward with it.
This is the full code of the progress I`ve done with my script. Just need to save the failed test's description...
Thanks, Eduard
P.S.: I have stopped pursuing the setResults() method since I am almost sure that even if it saves stuff, it saves it to junitResult.xml and that does not hold descriptions. Again, from manual testing, it seems that build.xml stores the test descriptions inside the SurefireReport action.
Eduard Moraru
unread,
Jan 7, 2015, 11:25:56 AM1/7/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message