Simplest plugin to parse and display test results in Jenkins

13,206

Solution 1

Wouldn't it be better if you can publish your test results in a format that is more understandable by Jenkins? If so, see this link on how to generate a simple test result. Once you have done that, the visual display that Jenkins offers comes to you at free of cost.

Solution 2

You can install the Groovy Postbuild Plugin and use it to parse your distinct line and display it right next to your build result :

def matcher = manager.getLogMatcher("(.*)  tests passed out of (.*)\$")
if(matcher != null && matcher.matches()) {
    passedTests = matcher.group(1)
    totalTests = matcher.group(2)
    manager.addShortText("${passedTests} / ${totalTests}")
}

You could also enhance it with a badge or a customized color depending of the success ratio.

Hope it helps

Share:
13,206
fashasha
Author by

fashasha

Updated on June 04, 2022

Comments

  • fashasha
    fashasha almost 2 years

    I've started using Jenkins in order to compile and test my builds periodically. The job is fairly simple. It compiles the build and then executes the tests.

    The test results are stored in a file. There's also a distinct line saying how many tests have passed. (Something like X tests passed out of Y).

    I'd like to know what's the simplest way/plug-in to display these results at the end of the build.

    I'd like a visual display, since I know Jenkins is very nice in displaying graphs over time/job.

    I appreciate your help, and forgive me if this question already exists on Stackoverflow. I haven't found anything close enough for me.

  • fashasha
    fashasha about 11 years
    Sorry for my delayed response. I've used xUnit similary to the suggested in the link you provided! I appreciate the help.