Integrating Jenkins and Selenium for functional testing
In recipe, we write a sample functional test Selenium.
Getting ready
Install the TestNG Results Plugin
:

Create a new project or build job in Jenkins.
How to do it...
Now let's try to execute the from Jenkins:

- Check in the
Test Project
inRepository
. Create aPetClinic-FuncTest
freestyle job in Jenkins.
- In the
Build
section, provide theRoot POM
location andGoals and options
to execute:

- Save the build job and click on
Build now
. - Verify the execution of the build job in the
Console Output
.
- It will open a Mozilla Firefox window and open a URL that is given in the code. This requires our PetClinic application to be deployed in a web server and running without any issues:

- Go to
Post-build Actions
and selectPublish TestNG Results
:

- Provide the
TestNG XML report pattern
:

- Click on
Build now
:

We have now seen how to execute Selenium-based test cases in Jenkins.
There's more
Go to the project dashboard and verify the graphs for TestNG results:

In the section...