Jenkins with the Measurement Plots plugin does not plot measurements Jenkins with the Measurement Plots plugin does not plot measurements jenkins jenkins

Jenkins with the Measurement Plots plugin does not plot measurements


I just figured it out with some help from the author. The trick is to escape the XML inside the XML and use <system-out>to feed the Measurements Plot plugin. The steps below shows how to use it and feed various values into the plugin:

  1. Create a New Job in Jenkins "free-style software project"
  2. Add String Parameter VALUETEST
  3. Add Build step Execute Shell Command is the code below.
  4. Add Post-build Action: Publish JUnit
    1. Test report XMLs: testdetail-*.xml
    2. Check Retain long staandard output
    3. Check Measurement Plots
  5. Save and Build Now.
  6. Plot will appear under Test Results. You need more than one run for the plot appear.

Execute Shell Command:

echo '<?xml version="1.0" encoding="UTF-8"?>' > testdetail-lcov.xmlecho '<testsuites name="CodeAnalysis" tests="2" failures="0" disabled="0" errors="0" time="0">' >> testdetail-lcov.xmlecho '<testsuite  name="Suite" tests="1" >' >> testdetail-lcov.xmlecho '<testcase   name="Case" status="run" time="0" classname="Suite">' >> testdetail-lcov.xmlecho '</testcase></testsuite>' >> testdetail-lcov.xmlecho '<testsuite  tests="1" >' >> testdetail-lcov.xmlecho '<testcase   name="Lcov" status="run" time="0" classname="CodeAnalysis.Coverage">' >> testdetail-lcov.xmlecho '<system-out>' >> testdetail-lcov.xmlecho "<measurement><name>Line Coverage</name><value>$VALUETEST</value></measurement>" >> testdetail-lcov.xmlecho '</system-out>' >> testdetail-lcov.xmlecho '</testcase></testsuite></testsuites>' >> testdetail-lcov.xml


The Measurement Plots plugin is designed to take values out of standard output and error buffer and should not be used to plot stats and details of test frameworks.

For xUnit there is a xUnit plugin that does the job quite nicely. Unless you want to handle some very specific type of data/information used by xUnit, this should the trick of nicely showing the tests results.