CONTINUOUS TEST AUTOMATION AND DEVOPS-Cypress as an example
As we know the technology has progressed so much, on meeting the demand for quicker turnaround times for application deployments has been one of the challenges. The importance of Continuous testing that helps to focus on software delivery pipeline or the business risk especially to drive rapid feedback on recent changes and to achieve that of being ready for deployment by continuously testing the application and keeping it production ready. Similarly the Continuous Test Automation is the process of executing many automated tests that are carried out each time on code changes. Also, For DevOps Professionals- Continuous Testing strategy, that covers the best practices required to excel at Continuous Testing (CT) at each step of the DevOps pipeline which helps enterprises to accelerate and prioritize testing to meet the needs of fast-paced Agile and DevOps initiatives
Since there are multiple problems or challenges faced on testing for Integrating multiple tools, selenium consistency, slowness etc.. and to address this for many solutions in the market found Cypress Studio that has different architectures while comparing with selenium. However, there is also a strong competitor to Cypress called Playwright CodeGen, the latest tools(to look into their low-code abilities) released in 2020 which has come up with lot of features and overcome almost all the tradeoffs that Cypress had. Cypress and Playwright are emerging frameworks, both can provide some impressive test feature creations(as listed below) would expect to find low code or no-code test automation solution.
- Coverage (most testing types including functional, performance, accessibility, APIs and more)
- Parallel and scalable(testing abilities like we have with Selenium Grid within cloud providers or in the open-source)
- Ability to import code (module into the codeless frameworks) and export codeless(created script into code like JavaScript)
- Test reporting and analysis (rich artifacts and with abilities to slide and dice test data)
- Integrability (DevOps and CI/CD tools like Jenkins, GitHub Actions, and more)
- Ease of use and quick ramp up with the tool
- Strong community, support, and documentation
However, for achieving this challenges looking more into Cypress – the Continuous Test Automation
Cypress:
Cypress is a JavaScript only framework build for modernized automation tools that has increased exponentially with the need to deliver products faster(which runs right next to the application) to the market and runs inside the browsers with rich debugging functionalities, also friendly for both Developer and QA
Installation of cypress(Windows/MacOS/Linux): Using Node.js Cypress is Installed, then Open file location where Cypress need to install and using npm init
install your package.json file(where cypress run within this package.json file that helps to track all the packages installed for the Cypress automation framework) and for project directory dir
then install the Cypress using npm install cypress --save-dev
. Hence this will Install your Cypress and to get started with the code install Visual Studio code editor to the system.
Cypress is written completely in JavaScript with React on the front end and Node.js on the backend. It uses Mocha syntax for tests, so it contains:
describe() : acts as test suites in Cypress
it() : acts as test cases in Cypress
Automation with Migration on Cypress, for example my Angular based project I used Protractor (front end automation tool for AngularJS) due to some maintenance issues I had to migrate it. Where found the best solution for Migrating on Cypress(that launched recently).
Continuous testing is still achievable with manual testing but still experience the same expected quality, However, automation increases the speed and errors coverage. using proper tools to make the testing process easier, faster, comprehensive, and more effective. Some Best Practices that help to build a continuous testing strategy effectively.
- Adopt More Test Automation
- Tool Integration
- Tracking Metrics
- Keep Communication Transparent
- Save Time with Headless Execution
- Integrate Performance Testing into Delivery Cycle
Continuous Testing with Cypress tool can deliver the products faster as it runs right next to the application, also found easier on debugging the test steps. it is easier to find the elements to write tests(not required to specify the elements by id or class). This also gives a clear picture of the number of tests run, pass/fail and the snapshot of the code that caused failures(A screenshot of each failure is captured below and A video for each run is created). Cypress dashboard gives access to tests(what happened during the test) that were recorded while running in headless mode. Record feature allows to record the entire execution of the tests.
Cypress (Beta)-Cypress is now Public Beta, which is open source for now (Note: this tool is still in an experimental stage and in beta it said about.) The codeless recorder tool is built into Cypress, but needs to be enabled through a command added to the cypress.json configuration file. To start- simply add this line { "experimentalStudio": true }
to your cypress.json file. Now, the tool is enabled, and when running Cypress in GUI mode :
npx cypress open
Edit an existing JavaScript test spec file and click on the red recording button to inject recorded test code into your script or build a whole new project. Cypress documentation recommends cloning built-in GitHub repository
Once the Cypress Studio(above screenshot) is enabled, editing a test step triggers the Cypress Studio button where able to add new commands to test. As of now we can use 5 main test commands that are supported by the tool – Check, Click, Select, Type, and Uncheck.
The Advantages of Cypress Studio
- Easy to use from the Cypress GUI tool
- Friendly debugging tool
- Richer test creation abilities
- Good documentation and help with sample project to ramp up
The Disadvantages of Cypress Studio
- Not Support Hover functionalities
- Limited test creation and assertion within the tool
- Able to exports only in JavaScript
- No support all browsers (like Safari WebKit)
Conclusion: The overview of Continuous Automation with Cypress tools(for both QA and developer/Devops team) is that it is in the beginning and potential to grow with core capabilities of a fully ready test automation framework. It is Convinced to choose Cypress as a test automation framework for the future simply as useful for the Continuous testing on build release and also allows us to focus on improving test coverage. Since then automated tests have become more stable and reliable, and a lot more fun to write. Thus planning to have Cypress to automate tests suits in near future.