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.

https://github.com/jenkinsci/junit-plugin/blob/master/src/main/java/hudson/tasks/junit/TestResultAction.java#L123...L142

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.

On 06.01.2015, at 23:46, Eduard Moraru <[email protected]> wrote:

> Hi,
> 
> I have recently written a pretty nice along the lines of this blogpost 
> http://brknthmb.com/post/76243353208/jenkins-adding-selenium-screenshots-to-test
>  (with some modifications).
> 
> 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.
> 
> There is even an example in the plugin's documentation ( 
> https://wiki.jenkins-ci.org/display/JENKINS/Groovy+Postbuild+Plugin#GroovyPostbuildPlugin-Example9%28thankstoKenBertelson%29
>  ) about doing it this way and I wonder if anyone else has encountered this 
> problem and how I may get around it.
> 
> 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
> 
> -- 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/CADGDyYJvfjduApWJUZA2z-omksMbTX8sTHiJM_7kex9K2buWbQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ACC7C44A-FB0F-4F60-89C7-C16F36DD9D2C%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to