Our legacy site: www.webwob.com   

Updates for running WebPageTest trhough Jenkins

I am still using WebPageTest locally and this page will add to the legacy pages with any new developments on my project.

    recent bash updates     jmeter updates*     jmeter v3.1     Start agent     WPT Jenkins job
    

Typical Jenkins configuration for a WPT Job

Manage the results HTML report, launch WebPageTest with our preferences and settings, archive all the artifacts for our Jenkins reporting, use Groovy Postbuild to set Pass or Fail more carefully (you can read from the Jenkins log to control the result here), create the trend graphs using the jmeter plugin.

1. Execute shell
  echo "in first shell script"
  rm -f *.jtl
  ls -all xml-returned-log.html
  
  echo "Trim the results file down"
  sed --in-place 's#<strong><font color=blue>Test starting#\n<strong><font color=blue>Test starting#g' xml-returned-log.html
  
  for i in `seq 1 10`;
          do
              count=$(grep -n "Test starting" xml-returned-log.html | awk 'BEGIN {FS=":"} {print $1}' | wc -l)
              echo "count = ${count}"
  
              if [ "${count}" -ge "12" ]
              then
               echo "got lots of results. Delete some now."
               first=$(grep -n "Test starting" xml-returned-log.html | awk 'BEGIN {FS=":"} {print $1}' | head -1)
               sed -i "1,${first}d" xml-returned-log.html
              fi
          done
          
  echo "Finished. Put html file back"
  cat xml-returned-log.html | tr -d '\n' > temp_tr; rm xml-returned-log.html ; cp temp_tr xml-returned-log.html
  
  ls -all xml-returned-log.html
  
2. Execute Windows batch command

  echo "in windows batch 1"

  "C:\Program Files\Java\jre7\bin\java.exe" -jar "C:\jmeter-3.0\bin\ApacheJMeter.jar" -n -t
  C:\jmeter\scripts\webpagetest-urlList-scripts-docLoaded-monitor.jmx -JurlListcsvFile=home_page.csv
  -JtestHost=DTE1206.server.local -JtestHostPort=80 -Jlocation=Office_wptdriver:Chrome.Cable
  -Jfail_limit=8000 -JfirstViewOnly=0 -Jruns=2 -Jitem_url=http://service.maxymiser.net/cg/v5
  
  echo "Finished windows batch 1"
  exit /b 0
  
3. Archive the artifacts
  *.*
  
4. Groovy Postbuild
[ see here: post_build.php ]

  println "Groovy setting build to PASSED"
  manager.build.@result = hudson.model.Result.SUCCESS
  
5. Publish Performance test results report (JMeter)
  **/*.jtl