In this article, I am going to show you how to integrate your Python Selenium Tests to Azure DevOps. You will also see how to trigger the tests on a particular time and execute them in parallel.
Pre-requisites
- Knowledge on Selenium, Python, pip and PyTest
- Working tests using the above tech stack. If you don’t have one, feel free to use mine from here
- Azure DevOps free account. Sign up here to get one
- GitHub repo to store your codebase
Steps
- Once you create a free account, login into Azure DevOps.
2. Create a new project with the details shown below by clicking Create Project button
3. Once your project is created, go to the Pipelines from the left menu tree
4. Now click on Create Pipeline
5. You can create a pipeline using YAML file or follow classic editor which is more a UI driven configuration process. I personally prefer that and we will see that in this article. Click on Use the classic editor link
6. We are going to use GitHub as our source. You can use the repositories mentioned here –
7. Once authorised your GitHub, select the repository and the default branch you need to build –
8. Create a “Empty Job”
9. Create the below listed tasks to your Agent Job –
10. Configure Use Python 3.8 task as follows –
11. Configure Install Plugins Command Line task as follows –
Note: You can also use Requirement.txt file to add the plugins and install directly
12. Add the below Script to Run Python Tests Command Line task –
13. The below code needs to be added to publish the artifacts like reports –
14. This command is to publish the test results into Nunit format –
15. Use “HTML Viewer” task to display your report –
16. Configure the trigger option to run it on daily basis at 8 AM UK Time –
Build Execution
Once all done click on “Save & Queue” button. As configured in Step 8, the tests will be executed in Windows Agent.
Test Report
Conclusion
What you have done till now is the Build Pipeline and there is a Release pipeline you can do as well.
Stay tuned & happy testing!
No comments:
Post a Comment