SDET Unicorns

Jenkins & GitHub Integration with Selenium Python

Jenkins

Table of Content

In this post, we will finalize everything by running our tests in Jenkins. We will cover Jenkins & GitHub Integration with the Selenium Python tests as well as generate a JUnit report at the end to see the results in Jenkins.

Pre-requisite

Make sure you have Jenkins installed in your local machine so that you can follow along with the rest of the steps. You can watch the Jenkins Installation video below that I made for the WebdriverIO tutorial series to see how to do that –


Push changes to GitHub

Once you have Jenkins installed, the next thing you will need to do is push all the code changes to your GitHub repository. But, before that, make sure to create a requirements.txt file to store all your packages details –

pip freeze > requirements.txt

This will create a new file listing all the packages that you were using in the virtual environment.

Now, you can push all the changes to GitHub.


Jenkins Integration

To make Jenkins work with the Python environment, you will need to install the ShiningPanda plugin. Then, create a new job in Jenkins, and in the build step select Custom Python Builder and add the following steps –

python -m venv env
call ./env/Scripts/activate.bat
pip install -r requirements.txt
pip install seleniumbase
sbase install chromedriver latest
pytest --junit-xml=report.xml --headless

The above script will create a virtual environment and install all the necessary packages for you. Once packages are installed we are triggering our tests using the pytest command.


Check out the video below to learn more about how to integrate your Selenium Python tests with Jenkins & GitHub –


To learn more about Selenium Python, check out the full tutorial series here for free!

I hope this post helped you out, let me know if you have any questions in the comments below!

Happy testing! 

My Resources

Thrive Suite: The all-in-one WordPress theme I used to create my blog.
Jasper AI: My favorite AI writing tool.
Surfer SEO:  A tool to help you rank your content on the first page of Google.

Write Content Faster

5/5

Write blog posts that rank for affiliate terms!

Join our mailing list

Unlock the Secrets to Becoming a SDET Pro in the Industry!

Stay ahead of the curve! Join our mailing list for exclusive insights, tips, and the latest industry updates delivered straight to your inbox

Table of Content

Related Post

7 Principles of Software Testing

7 Principles of Software Testing with Examples

Software testing plays a crucial role in the software development life cycle as it helps ensure the quality, reliability, and performance of the final product. Software testing is not just about finding defects; it also provides valuable insights into the overall quality of the software. By conducting effective software testing, it shows how well the application behaves in different scenarios and whether it meets user expectations.

Read More »
Differences Between CI/CD and DevOps

Key Differences Between CI/CD and DevOps

Software development is far from a simple journey that involves merely executing code and launching applications. It often presents challenges, as it’s rare to get everything right from the start. Each time you implement new or frequent code changes, you inadvertently introduce potential issues that can be time-consuming to resolve. This complexity necessitates a structured approach to ensure smooth production.

Read More »