Why we should be  testing with Cypress!
Tags: cypress, testing
Published: 2019-11-24 01:50:07

Hello everyone, today I will explain why to use Cypress to test your front-end components its really easy and honestly anyone can learn to use it!


# Why Cypress...

1. THE UI


The awesome part about Cypress Testing is the Cool GUI that comes with the software so you don't have to test everything in CMD line, it is really self explanatory and uses google chrome to test your program!

All you need to do is have your front-end and back-end(if the components require the back-end) servers running and click run tests! It looks like this!


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/dwe1iu220sfm57zlbonh.png)


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/5pmc880nsbnn7fxf08c4.png)


The top Image is the dashboard this allows you to pick which tests you want to run...

The Second Image is the actual tests being run in google chrome, the great advantage of this is you can actually watch the tests being run... and find out exactly what step in the process the tests are failing! this makes bug hunting so much easier and trust me it makes you a better programmer!

2. Cypress does not use Selenium

Most end-to-end testing tools are Selenium-based, which is why they all share the same problems. To make Cypress different, they built a new architecture from the ground up. Whereas Selenium executes remote commands through the network, Cypress runs in the same run-loop as your application.

3. Cypress works on any front-end framework or website.

Cypress tests anything that runs in a web browser. All of the architecture surrounding Cypress is built to handle modern JavaScript frameworks especially well. They have hundreds of projects using the latest React, Angular, Vue, Elm, etc. frameworks. Cypress also works equally well on older server rendered pages or applications.

4. Cypress tests are only written in JavaScript.

While you can compile down to JavaScript from any other language, ultimately the test code is executed inside the browser itself. There are no language or driver bindings - there is and will only ever be just JavaScript.

5. Cypress is all in one.

Writing end-to-end tests takes a lot of different tools to work together. With Cypress you get multiple tools in one. There is no need to install 10 separate tools and libraries to get your test suite set up. They have taken some of the best-in-class tools you are likely already familiar with and made them all work together seamlessly.

6. Cypress is for developers and QA engineers.

The tests don't require you to be a developer to understand or write them they are super readable and the one can learn how to write cypress tests within minutes and all you need to start is `npm install cypress`

This is good for devs because we don't have to waste time writing tests that could be used for solving tests

and this is good for QA engineers because they don't have to know complex javascript logic to understand what the test is supposed to do.

7. Cypress runs much, much faster.

These architectural improvements unlock the ability to do TDD with full end-to-end tests for the very first time. Cypress has been built so that testing and development can happen simultaneously. You can develop faster while driving the entire dev process with tests because: you can see your application; you still have access to the developer tools; and changes are reflected in real time. The end result is that you will have developed more, your code will be better, and it will be completely tested.

Their Dashboard service pushes this optimization even further!

To learn how to use cypress visit cypress.io or check out their docs at 

https://docs.cypress.io/guides/overview/why-cypress.html

or maybe I'll just write another blog... we'll see