Selenium – Java & Azure DevOps – Let’s unleash the power!

In this article, we will see how to integrate our Java based Selenium scripts with Azure DevOps. I have seen loads of articles and watched videos integrating the Selenium tests to Azure DevOps, but they are mostly for C# lovers. But, for Java fanatics, I see NO documentation available and hence I thought of writing this article.So, let’s begin.

Pre-requisites

  1. Knowledge on Selenium, Java, Maven and TestNG
  2. Working tests using the above tech stack. If you don’t have one, feel free to use mine from here
  3. Azure DevOps free account. Sign up here to get one
  4. GitHub repo to store your codebase

Steps

  1. 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. Select Maven as the task for your job and click Apply

8. In the next page, configure your Pipeline with the below details. I am going to use macOS-10.14 as my agent where I will be running the tests.

Note: The agent will be hosted by Azure DevOps on its cloud and you don’t have to worry about bringing it up

9. It’s time to configure the Maven and its goals. You can configure the task by referring the below screenshot and the maven goals as –

clean test -Dsurefire.suiteXmlFiles=./testng.xml -Dbrowser=chrome -Dgroups=apiTest -Denvironment=qa

10. One thing you to note is, Azure DevOps doesn’t support reporting like Extent Reports or any other fancy reports at the moment. It uses JUnit test results to generate its test results view in the pipeline.

11. Click on Save & queue. This will trigger the build pipeline now

12. In the Run Pipeline window, click the Enable system diagnostics option. Then, click on Save and run

13. Now, click on Agent job 1 link and navigate to details –

14. So, wait for the build pipeline to finish –

15. Congrats! You have just ran your first build pipeline using Azure DevOps and Selenium Java Maven Framework.

16. Now, let’s see the test results. Navigate to the Pipeline and click on the recent pipeline –

17. Click the Tests tab on the top next to Summary –

18. Voila! Test Results looks great!

Conclusion

What you have done till now is the Build Pipeline and there is a Release pipeline you can do as well. But, I will write about that in the next article.

Stay tuned & happy testing!

Image Credits:

https://google.com

Leave a comment

Website Powered by WordPress.com.

Up ↑