What is the problem statement?
Tests, especially automated tests, are vital to software delivery as they assure stability of the product while the delivery is sprinting through the iterations. However a flaky test in the feedback suite can introduce the ‘broken-window’ syndrome. This is a common observation with the traditional e2e tests written using the most popular tool - selenium. Because of the instability of the tests, developers tend to hate and subsequently ignore the feedback disseminated by the e2e tests.
Why it needs to be solved?
But this ignorance can prove costly at times. Moreover executing the e2e journeys manually is practically not feasible. Hence there is a strong need to write stable tests which the developers can also contribute to. There are new age testing solutions, powered by nodejs, to address this puzzle.
How it can be solved?
Why we chose cypress?
Cypress came to our rescue while we were working on migrating a banking web application from a Kony based framework to a reactjs powered UI. With multiple subsystems involved, outside our control, it was necessary to mock/ stub requests for the stability of the test suite. A quick pilot using nightwatchjs exposed the limitations of selenium as the network communications used to timeout due to longer back-end processing activity. With cypress, we were able to build test suite that were quick and bankable. The state-of-art reporting feature of cypress was one more convincing factor for the team to adopt it wholeheartedly.
Takeway from workshop
In this workshop, we will understand what makes cypress a strong candidate for e2e testing. We will write tests to automate user journey, learn to stub requests and control network traffic. After the session, we hope the participants step out of the room with a newer perspective towards e2e tests.
- What is wrong with e2e tests?
- How cypress can solve this?
- Unique features of cypress that stand out
- How we exploited it to solve our problem
- Problem statements for the workshop demo
- write a simple cypress test to validate a user journey
- understand debugging, reporting in cypress
- make the test suite CI ready - setting up environment configuration, choosing browser, and recording tests
- stubbing in cypress to test edge cases
- use other important features of cypress such as making XHR request, using plugin, writing custom commands
git, nodejs > v6, preferably vscode, and lots of enthusiasm