Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show results of individual test pass/fail in Jenkins?

We're using Scala + Maven + ScalaTest runner + Jenkins. We have JUnit-style XML output going here:

test_dir/target/scalatest-reports/

Right now we can see entire build pass/fail, or dig through the verbose Console Output to see test pass/fail (not ideal), but I'm sure there's a better way.

I've tried several of the post-build steps such as:

  • Aggregate downstream test results
  • Publish xUnit test result report

But can't get a table of test results working.

like image 642
Aaron Shaver Avatar asked Nov 13 '12 21:11

Aaron Shaver


People also ask

Where do u see failed test cases in Jenkins?

Where do u see failed test cases in Jenkins? If you use the TestComplete Support plugin to run TestComplete tests with Jenkins, after the build run is over, the plugin will publish test results to Jenkins automatically. You can view them on the build results page.

How do I create a test report in Jenkins?

Alternative Method To Generate TestNG Reports in JenkinsLogin into Jenkins. Manage Jenkins and Install TestNG Result Plugin. Please make sure that you restart Jenkins after the plugin installation. Next, go to Jenkins Home Page → Create New Jenkins Job and in Post-Build Action select → Publish TestNg Result.


2 Answers

There are two options:

  • ScalaTest can generate HTML reports. Just add

    (testOptions in Test) += Tests.Argument(TestFrameworks.ScalaTest, "-h", "target/scalatest-report")

to your 'build.sbt'. Running 'sbt test' will then generate an HTML report in the folder 'target/scalatest-report'.

In Jenkins you can use the 'Publish HTML' plugin to capture this report for a build. The test html becomes then available for each build and also on job page.

  • ScalaTest also generates normal JUnit XML reports in the 'target/test-reports' folder. The Jenkins these reports can be captured with the 'Publish JUnit XML test report' post-build-action which is default available in Jenkins I think.

Both solutions give a view on the test results and they can be used together.

like image 53
Joost den Boer Avatar answered Nov 16 '22 02:11

Joost den Boer


You should better describe your symptoms. JUnit-style XML report is the basic form of test report supported by Jenkins/Hudson, so I suppose the problem is relatively simple. Please compare your configuration with the following example:


enter image description here


I would suggest the following:

  1. Check you configuration (it is likely jenkins is not able to find the actual report file)
  2. Look through the console output to make sure there is no warning message related to XML report file
  3. Verify XML report is not empty and valid
  4. Try to use JUnitReport tasks to generate HTML form
  5. Finally, switch to TestNG if you can
like image 22
Renat Gilmanov Avatar answered Nov 16 '22 04:11

Renat Gilmanov