This article will not discuss the importance of software testing or the types of testing or testing strategy that exists for each problem. In this article, we already assume that tests are essential, and we are going to talk about something more specific than end-2-en tests. To remember:
This pyramid shows the level of importance and dedication time given to the different types of tests.
The second image shows the implementation cost and the maintenance cost of the different types of tests.
For end-2-end images, these types of tests are costly, and you should not spend much time on them. Still, these types of tests perform a critical function, which is to simulate and convert manual tests into automated tests. It involves testing execution flows in an application from start to finish, performing a test of the entire system integrated with your systems, and identifying emerging errors. But why, if they are so important, should you spend little time? This is because end-2-end testing tests the graphical interface use cases. A graphical interface can have many use cases and depending on the test strategy these can increase or decrease, many factors can cause tests to fail and increase the requirements for tests:
- Change in interface
- Failure of any subsystem produces system failure generate
- The difference between browsers
- The difference between screen
- Browsing speed
- The operating system where the browser runs
- Implementation of the tests
Each of the factors mentioned makes e2e tests not only expensive in human resources and time, but they are also difficult to maintain, so investing in other types of tests is preferred. But this does not make e2e tests not important, and it becomes a problem to solve. One of the solutions are tools that facilitate implementing tests. Currently, the majority of implementations are with WebDriver Selenium, although now, the development community has released new tools that come to compete with Selenium. Next, we will carry out an analysis of e2e testing tools based on the problems they solve and the most relevant characteristics of each one, and whether there is a significant improvement in the implementation of tests.
- Effortless installation
- Easy to implement
- Simple to maintain
- High-level code.
- Black box and white box tests.
- Learning curve.
npm install selenium-webdriver
And run the server
java -jar selenium-server-standalone-2.45.0.jar
- Keep: there are problems in browsers. When updating the browser, the driver must be changed.
- High-level code. It works with web driver technology, and your API is implemented in several languages, your app’s web driver can change according to its version, and you must have knowledge of good practices to implement the API well.
- Black box and white box tests: There are many dependencies on the interface, and you must handle good practices to do black-box tests.
Nightwatch.js is an automated end-to-end testing framework for web applications and websites. It is written in Node.js and uses the W3C WebDriver API (formerly Selenium WebDriver) for interacting with various browsers. It is a complete testing solution that aims to simplify writing tests and setting up Continuous Integration and Continuous Delivery. Nightwatch can also be used for writing Node.js unit and integration tests. Read more about how Nightwatch here: https://nightwatchjs.org/gettingstarted.
- Installation: it is by node npm, and the server is the same;
npm install nightwatch Server npm install geckodriver --save-dev or selenuim server npm install selenium-server --save-dev Implementation: It is easy to implement and easy to run through an npm project.
- Maintenance: It is supported and designed for new DevOps technologies
- Black box and white box tests: It handles a high-level code, and clean syntax that avoids bad implementation, so good black box and white box tests can be performed.
- Results are clean and easy to identify and indicates the process step-by-step. This is a great advantage and makes it easier to observe faults.
It is a very different tool from the previous ones. It has a new architecture and gives a noticeable improvement when it comes to maintenance and development speed.
- Installation: it is an all in one, it is simple, and you only need an npm installation. Whereas Selenium executes remote commands through the network, Cypress runs in the same run-loop as your application.
- Implementation: “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. If you opt for our Dashboard Service, parallelization and automated load balancing will further supercharge your test speeds” https://www.cypress.io/how-it-works/
- Maintenance: It has a friendly interface and quick access that can quickly identify problems and correct them. Record the step by step of the tests.
- Clean code and its clean syntax, easy to learn and easy to implement, but it does not avoid performing bad practices as Nightwatch.js tries to do and best of all, it is easy to identify errors and allow TDD tests on end-2-end that any of the other test tools cannot do it.
There is no doubt about the importance of end-2-end testing and that the entire software engineering ecosystem must be improved. The community advances showing new and improved tools among them. We can compare three: Selenium, Nightwatch, and Cypress. We can get a lot of improvements to Selenium, but it keeps problems from the start. Nightwatch improves in its syntax in its higher-level framework than Selenium and seems to improve Cypress. However, Cypress’s best strength is to help speed up development with tools such as a visual interface, and it changes its architecture to achieve an Automated end-2end testing ecosystem with a novelty of implementing TDD.