Protractor Automated Testing header

Protractor – Automated end-to-end testing for AngularJS

One of the things that come along with working in web development is you can’t fake it. It’s either do it or don’t do it, where the only measure is an answer to the question: “Is it working?” It kind of resembles life, I would say.

Last three years, I have been working as a tester in AVS Solutions development team. My job is to make sure we deliver fully functional web applications with the requirements requested by the client. I create test cases based on acceptance criteria and then run them. Manual testing, as well as, building and conducting automated end-to-end tests, are used to carry out the test cases. One method of testing does not exclude the use of another. Manual and automated testing should both be incorporated into the development process to generate a product of the greatest possible quality.

Manual testing VS Automated

Manual testing is time consuming, repetitive and requires more effort, but it is necessary if I want to ensure that the application is error-free and working in conformance to the specified functional requirements. Other than that, any new application, must be manually tested before it’s testing can be automated. Furthermore, not all tests can be automated. As a result, manual testing is a key aspect of my work.

Automated testing is the best way to increase effectiveness, test coverage, and speed up test execution and productivity. Usually, I automate simpler, more repetitive test cases, so automated testing makes manual testing more efficient.

Protractor Automated testing

Since AVS Solutions develops applications in Angular, natively, I use Protractor for writing automated tests. It is a neat tool built on top of WebDriverJS, that combines native events and browser-specific drivers to simulate how a user might interact with your App. Protractor can run the next step in the test as soon as the webpage completes any outstanding tasks, so I don’t have to wait for my test and webpage to sync. It supports behavior-driven development (BDD), an important aspect of agile development processes, and employs the Jasmine test framework.

Let’s say we have one simple test:

GIVEN User visits some website
WHEN User Insert text in input field
AND User submit text by clicking on button
THEN Page title is changed to submitted text

Protractor is part of JavaScript ecosystem, which is asynchronous in nature, so the sequence of execution is sometimes disrupted, and thus the expected results are not returned. Each line of code run one after another, and activity of one sometimes interfere with activity of another. That’s when a promise comes into the picture. Protractor solved this problem by managing promises via Control Flow. Control Flow makes asynchronous calls appear synchronous, thereby avoids the use of Promises entirely.