About the Customer
Industry: Industry Specific
The next big thing in 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 been 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 which 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 which 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 which 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 which 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.
Tools & Technologies
- 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”
For exact steps and guidelines for installing and running the first code using Protractor, you can contact QA team of SPEC India anytime.
- 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