Running Serenity BDD stories with Jenkins

In this tutorial, we will learn how to run Serenity BDD stories with Jenkins. This allows you to run serenity bdd stories automatically with a single button click, or schedule story runs automatically, history of test results to check progress and test result trends etc.

Serenity BDD stories with Jenkins

In this tutorial, we will learn to configure a Jenkins job to run the serenity bdd stories. If you are new to Serenity or JBehave or wondering how to create a sample bdd project, then follow this link : sample serenity bdd project

or

Setup Serenity BDD project from command line.

If you are relatively new to Jenkins, then follow this link to learn how to install Jenkins: How to install Jenkins?

JDK configuration in Jenkins : Configure Jenkins

Install Plugin

To install a plugin,

Manage Jenkins >> Manage Plugins >> Search Thucydides Plugin.

Select the plugin and click on the install button.

Note that: Thucydides is the old name for Serenity BDD library.

Configure the project

Launch Jenkins >> New Item

Enter the Jenkins Job name and select >> Maven Project and click OK button.

 

In the /configure page you set a variety of build and run options for the
Jenkins Job.

The most important one is to specify the Root POM for the project.
Give the path of the pom.xml of your project.

Under Goals you can specify the maven goals : clean verify.

Post build action.

Add a post build action for the serenity report.
Specify the /target/site/serenity which has the index.html report. Once this is done, the Serenity report will show up in the next Jenkins build.

Click on the Build Now to run the serenity bdd stories.

To check the build console output, click on the ‘Console Output’ of the job.

 

 

You can see that serenity story reports are now configured and with a button click you can view the report in Jenkins.

 

 

The main advantage of moving your story runs to Jenkins is that , you will get a glimpse of your story run trends build over build.

Story trends in Jenkins

 

 

Test result trends displays the graph of story pass/failure/errors from build to build. This would enable you to get more insights of the automation effort.