smoke tests in jenkins code example
Example 1: how to configure smoke test in jenkins
Our jenkins job is configured to get my automated tests from GitHub and
run every day using Maven.
1- In configuration, first I created a new job and gave name "smoke tests".
2- Then I selected option git in the Source Code Management section and
entered the path to my framework on GitHub. And, also entered the git
credentials.
3- Next configuration is about build triggers where I chose option Build
periodically and enter the time how often I want to run my tests.
4- In the Build section, I choose option invoke top level maven command
since my automation framework is created using maven.
5- In the section I enter the maven command (without the mvn part).
6- So, its normal command to run my test using terminal is 'mvn test',
in jenkins I only enter 'test'.
7- Here I also enter the tag I want to run using command line.
test -Dcucumber.options="--tags @smoke"
8- if I want to run regression tests, command is:
test -Dcucumber.options="--tags @regression"
9- In the Post-build Actions, I do couple configuration,
1. I add Cucumber reports option. This is available because we have
installed cucumber html reports plugin to our jenkins.
Cucumber reports plugin will generate html report for every build.
Every time we run smoke tests on jenkins, we get a new
report. and all reports for all build are saved.
2. I add email option as the next Post-build Actions. Here I configure
it so that everyone in my agile team is notified about the
test results
Example 2: Who sets up Smoke Tests in Jenkins
As an automation engineer, I work with the devops/operations supports to
create my smoke tests.
For running my tests, I need certain plugins installed on Jenkins,
I also need java, maven configured on jenkins, I also need browsers
installed on the server where the tests will run.
In my project, only devops/operations support team members have right to
do the configurations above. that is why I have to work with them.
Once the configuration of the Jenkins is completed,
I can create and run the smoke test job.