Jenkins Pipeline: Attach failing test screenshot

Last modified by Vincent Massol on 2020/01/28

Jun 06 2017

This is an extract from a blog post by Vincent Massol.

On the XWiki project we've started moving to Jenkins 2.0 and to using the Pipeline feature through Jenkinsfiles.

When we run our functional tests (we use Selenium2/Webdriver), we record a screenshot when a test fails. Previously we had a Groovy Scriptler script (written by Eduard Moraru, an XWiki committer) to automatically change the description of a Jenkins test page to include the screenshot.

So we needed to port this script to a Jenkinsfile. Here's the solution that was found.

Tags:
    

Get Connected