JSFoo Coimbatore 2019

On building faster, performant and secure web applications

Write automation tests in your favourite language javascript

Submitted by Biswajit Pattanayak (@biswajitp) on Apr 19, 2019

Technical level: Intermediate Status: Under evaluation

Abstract

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?
One of the shining star among these new age solutions is Cypress. Due to its unique architechture, it exactly knows what’s happening in the application under test and therefore makes tests very stable which was missing in webdriver based tools that communicate with browser over network. Moreover it’s easy debug-ability and reporting features make is very developer-friendly. The icing on the cake is that the cypress tests are written in javascript. Moreover cypress scripts can test application build using all javascript frameworks.

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.

Outline

  • 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

Requirements

git, nodejs > v6, preferably vscode, and lots of enthusiasm

Speaker bio

Shabareesh JL is a javascript enthusiast with 6 years of experience in UI development. He is currently working in Thoughtworks, Hyderabad.
Biswajit Pattanayak is a QA with Thoughtworks, Hyderabad. After stumbling upon cypress, he prefers to use javascript to solve his testing problems.

Slides

https://www.slideshare.net/biswajitpattanayak50/cypress-workshop-for-jsfoo-2019

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('You need to be a participant to comment.') }}

{{ formTitle }}
{{ gettext('Post a comment...') }}
{{ gettext('New comment') }}

{{ errorMsg }}