What's the best method to do end to end test in Angular 5?

Issue

I’m a beginner on this technology.

I’m using Angular 5 as front end for a simple application I’m working on, I want to learn how to use test end to end in angular5, I found that there are many tools to reach it.

There is Jasmin, Protractor…

It’s seems a little bit difficult to work with, but I want some advice:

What’s the best tool for end to end test?

Do you know any helpful links with simple explanation on how to do it?

Solution

I don’t know what is THE best tool for end to end test, but can give out some advice basing on my little experience.

To my knowledge, end to end test (e2e) is just a little bit like blackbox test, we can run a program to simulate a human being to use keyboard or mouse to operate the system. So there is no particular e2e tool that just work for Angular, that means, any tool is good at e2e test can be used to test Angular.

But be careful, there is no easy tool for e2e test. As you are building an auto machine to replace human, you need to write down every single test case in some language, you need to specify the operation steps and expectations, and you need to test the test machine itself. Even for the very basic login screen, you need to write down test cases to let it know where is the username input field, where is the password input field, and how to click the login button, plus, remember to save the cookies the server send to you. Only after successfully login, and save cookies correctly can you go to next step. All these test for test machine will cost time, but as you like.

For tools, I used Casper.js before, which you can google. It include phantomjs at bottom. Some people may like Selenium, and some others may choose Nightwatch. But none of these tools are easy. The best way is to try to download and write some simple test case to try by yourself.

UPDATE: Protractor should be the best tool for Angular apps.

Answered By – Zhang Buzz

Answer Checked By – Katrina (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.