The next big thing in the developing area is AngularJS. AngularJS lets you extend HTML vocabulary for your application. The resulting environment is extraordinarily expressive, readable, and quick to develop. Because of this most of the developers are migrating themselves/existing Projects to build/use AngularJS.
Currently, The Era of Software Automation has begun. Most of the testers are well versed in automation using Selenium/QTP and other tools as well. But with the introduction of AngularJS, tough days have started for Selenium as selenium lacks in providing support for automation of AngularJS.
This gave an opportunity to testers of SPEC India to harvest a way to automate sites that are developed using AngularJS. Thus, Protractor was the outcome of this opportunity. Protractor supports Angular-specific locator strategies, which allows you to test Angular-specific elements without any setup effort on your part. Protractor is using WebDriver for running automated tests.
When we inspect elements of sites that are not developed using AngularJS and sites which are developed using AngularJS, there are very fewer similarities between them. This turned as a challenge to find a tool that can find elements of AngularJS. Few of the challenges encountered are mentioned below:
How to automate the elements which are not findable by selenium (AngularJS elements)
Find a freeware/open-source tool that can locate AngularJS elements
Find such a tool which do not require very deep knowledge of coding languages
Install-Configure-Run the tool for the first time
To overcome such a challenge, we have used a very fine tool named as Protractor. Protractor is an end-to-end test framework for AngularJS applications developed by Angular Team.
Protractor uses WebDriver to control browsers and simulate user actions
Protractor uses Jasmine for its test syntax. As in unit testing, a test file is comprised of one or more it blocks that describe the requirements of your application. It blocks are made of commands and expectations.
Commands tell Protractor to do something with the application such as navigate to a page or click on a button. Expectations tell Protractor to assert something about the application’s state, such as the value of a field or the current URL
If any expectation within it block fails, the runner marks it as “failed” and continues on to the next block.
Our detailed and accurate research , analysis, and refinement leads to a comprehensive study that describes the requirements, functions, and roles in a transparent manner.
We have a team of creative design experts who are apt at producing sleek designs of the system components with modernized layouts.
Our programmers are well versed with latest programming languages, tools, and techniques to effectively interpret the analysis and design into code.
Quality is at the helm of our projects. We leave no stone unturned in ensuring superior excellence and assurance in all our solutions and services.
We have a well-defined, robust, and secure launch criteria that offers us a successful implementation clubbed with detailed testing, customer acceptance and satisfaction.
Implementation To install Protractor first we need to install Node JS
With the help of small command: “npm install -g protractor” we can install Protractor
Than we need to update web driver manager by following command: “webdriver-manager update” That’s it, now just write code in any editor (notepad/notepad++ etc) and save it with .js extension. Open the conf.js file from Protractor folder and give the name of the code file in specs section.
Use the following command to run the test: “protractor conf.js”
Outcome Using Protractor, QA Team of SPEC India are able to automate AngularJS flawlessly
Also we have found that we can use Protractor in non-angular sites as well
Comparison with Other Tool - Karma As Protractor is developed by Angular team, they are recommending Protractor
The Small tests for the logic of your individual controllers, directives, and services should be run using Karma. Big tests in which you have a running instance of your entire application should be run using Protractor
Protractor and Karma cover different aspects of testing – Karma is intended mostly for unit tests, while Protractor should be used for end to end testing