CICD for Automation Testers – Complete Course Here
CICD for Automation Testers
CICD (Continuous Integration – Continuous Delivery / Deployment) is the automated end to end flow of software development process. Though complete CICD flow is not to be built by automation testers, but Understanding of the flow and tools is must. Out of CICD, CD part (Deployment part) can be ignored by automation testers. IT is purely job of Dev-ops engineer / deployment team.
But as a Automation Engineer, you should be well versed with complete CI (Continuous Integration) process. We all learned about automation tools (Selenium / UFT / TOSCA / any other), Automated web / desktop / mobile applications & that’s preaty easy because we have huge community for most of them. But test automation is not that all about.
Most critical part in test automation is, integrating test automation suite / framework with various Dev-ops tools. As a part of this post, I will be talking about how selenium Test Automation Framework can be clubbed / integrated with other devops tools like Jenkins, Docker, SonarQube and many other.
Below image shows complete CICD flow. The complete flow can be achieved using CI Tools. Most commonly used Continuous Integration tool is Jenkins.
The complete Continuous Integration flow is explained with the help of below steps.
Step1: Test Automation Framework is ready
We all know how to build test automation framework (Let us say for Selenium in this case). Create Maven compatible Selenium Test automation framework.
Step2: Push the code in centralized repository
If multiple persons are working on the same project, You need to have the code on centralized repository, where each one can have thire code. As well same code (from centralized repo. to be used for running the test suite from Continuous Integration tools (Say Jenkins). In this case, I am using GitHub for storing my code.
Step 3: Parallel Test Execution / Cross browser Testing
If you want to execute your test cases in parallel, then use Selenium Grid. It will help to achive parallel test execution on reqired node machine, ultimatly reducing execution time. If you want to do cross browser testing, configure required browsers on different node machines & hub can trigger them as required.
Step 4: Cloud Testing (On browserStack)
Selenium Grid is best for parallel execution and for cross browser testing. But in case your organization do not have grid setup & enough infrastructure, you can use cloud machines to achieve same. There are various vendors like browserStack, SauceLab & many others, who provide the ready made infrastructure which can be used. Just like how we use Selenium Grid, BrowserStak can be used. Advantage of having testing on cloud is, if your testing is for short term and you do not want to invest in getting required infrastructure ready & maintain it, these cloud platforms can be used as and when you want & pay them accordingly.
Step 5: Static code analysis
Creating Test automation framework, means you are writing some code. That code needs to coded by following all coding standards. Firstly this can be achieved using peer review. But this can also be achieved by using some static code analysis tools like SonarQube. SonarQube is a static code analysis tool, supports various coding languages. SonarQube addresses not only bugs but also coding rules, test coverage, code duplication, complexity, and architecture providing all the details in a dashboard.
It gives you a snapshot of your code quality at the certain moment of time as well as trends of lagging and leading quality indicators. It provides you with code quality metrics to help you take the right decision. There are code quality metrics that show your progress and whether you’re getting better or worse.
SonarQube can be integrated in Continuous Integration pipeline just before test execution. Here all you automation Framework code will be scanned & if your code is up to the mark then it will allow test execution otherwise it will report failure.
Step 6: Dockerised Test Execution / on multiple platforms as required
Docker is a great way to achive virtualization, to run your applications without affecting other systems. In docker, various containers can be deployed on docker. Container includes the application and its dependencies.
To do test execution on dockerised platforms with different versions, you can download various version images & deploy them on docker. Selenium Grid can be deployed on docker & hub – node architecture will be achieved automatically. Advantage of using docker for test execution is, to test applications on various OS, various browser versions and including all dependencies, ultimately saving all infrastructure expenses.
Step 7: Watch test execution
If you want to have a look on test execution, then VNC viewer can be used where you can view all browsers at a time. This is optional and is just to make sure how execution goes. Because if the tests are running on docker, you wont see any UI at your end until you use VNC viewer.
Step 8: Automatic Defect creation
If any of your tests fail, then those can be logged. JIRA API can be used to connect JIRA tool from your java code. As soon as test case fails, automatic bug will be created and can be assigned to respective person.
This is the complete Continuous Integration pipeline & above steps can be used as required.