Skip navigation

Developing an Application? Use Protractor to Test it!

Blog

Today, Rich Internet Applications developed on JavaScript (AngularJS) – a framework extending the functionality of HTML and used to quick launch applications – are becoming increasingly popular in web application development. Protractor is an automation framework developed to support end-to-end (E2E) testing and unit testing for AngularJS and non-AngularJS applications as a user would run the app in a real browser.

The end-to-end UI testing method tests all components of how an application works from start to finish and from the perspective of the user. End-to-end testing or functional testing:

  • Communicates backend functionality with frontend per design
  • Validates an application from the user perspective
  • Achieves functional integration and system testing
  • Provides increased confidence before releasing an app to production

With the large number of pages and interactions in most modern applications, manual end-to-end testing becomes extremely time consuming, resulting in the need for test automation.

Test automation not only speeds up the process, but it also finds bugs in the early stages of development and supports multiple executions faster in comparison to manual testing.

Based on our search for a functional test automation framework, we recommend using Protractor, an open-source framework designed to verify the health of AngularJS applications, which launches tests against AUT (application under test), and runs them in a real browser as a user would do it. Protractor runs on top of the Selenium WebDriver and works as a solution integrator, combining powerful tools and technologies such as NodeJS, Jasmine, Cucumber, and Mocha. In addition, Protractor provides new locator strategies and functions that are very helpful to automate AngularJS applications, like waitForAngular, By.binding, By.repeater, By.textarea, By.model, WebElement.all, WebElement.evaluate, etc. To achieve end-to-end automation, businesses will need to build a wrapper on top of the Protractor framework to communicate with non-web applications, such as mobile or Thick Client apps.

Why should companies use the Protractor framework?

  • It’s effective and efficient. Test scripts and data are loosely coupled and page objects are separate from the page modules, resulting in an increased test development pace.
  • It’s scalable. Protractor reduces code redundancy and has a large scope of reusability.
  • It’s easy to maintain. Changes can be adoptable with minimal efforts, and test data and page object property changes do not impact the code.   
  • It’s test data is configurable. Protractor allows tagging of test suits, controlling test data sets, skip data set iteration, and configuration at the feature level, test scenario level, and test step level.

If your business is already using the Protractor framework, keep these best practices in mind to help you write robust tests:  

  • Avoid using potential CSS attributes, mainly IDs and Classes.
  • Take advantage of Angular JS attributes.
  • Use the Page Object Model to organize elements and write functions to perform actions on the page.
  • Think of every test case as an end-to-end scenario in your spec file with pre/post conditions using Jasmine BeforEach/BeforAll/AfterEach/AfterAll statements.
  • Avoid explicit waits to handle Page Loading/Element Loading/Element Visible, etc.
  • Loosely couple test data and test specs.
  • Use the NodeJS DataProvider module for achieving data-driven tests.

Interested in learning more about end-to-end testing and how EPAM can help you implement the Protractor framework for testing your applications and websites? Contact us.

Hello. How Can We Help You?


Our Offices

  • Canada

    • Ottawa

      343 Preston Street,
      ON K1S 1N4, Ottawa
      Canada

      Map
    • Toronto

      5 Park Home Avenue,
      Suite 400,
      ON M2N 6L4, North York,
      Toronto
      Canada

      Map
      F: +1-416-595-1551
  • Mexico

    • Guadalajara

      Periférico Sur #8110,
      Col. El Mante
      45609 Tlaquepaque, Jalisco
      Mexico

      Map
  • United States

    • Newtown, PA

      41 University Drive,
      Suite 202,
      Newtown, PA 18940
      USA

      Map
      F: +1-267-759-8989
    • Bellevue, WA

      110 110th Ave. NE,
      Suite 310
      Bellevue, WA 98004
      USA

      Map
    • Boston, MA

      21 Drydock Avenue,
      Suite 410 W,
      Boston, MA 02210
      USA

      Map
    • Conshohocken, PA

      101 East 8th Ave,
      Suite 201,
      Conshohocken, PA 19428
      USA

      Map
    • Los Angeles, CA

      11601 Wilshire Blvd,
      Suite 350,
      Los Angeles, CA 90025
      USA

      Map
    • New York, NY

      24 West 25th Street,
      5th Floor,
      New York, NY 10010
      USA

      Map
      F: +1-267-759-8989
    • Philadelphia, PA

      30 South 15th Street,
      9th Floor,
      Philadelphia, PA 19102
      USA

      Map
    • San Francisco, CA

      222 Kearny Street,
      Suite 308,
      San Francisco, CA 94108
      USA

      Map
    • Washington D.C.

      7901 Jones Branch Drive,
      Suite 400,
      McLean, VA 22102
      USA

      Map
  • Australia

  • China

    • Guangzhou

      Unit B01, 23/F,
      Yuexiuxinduhui Building,
      No. 236, 6th Zhongshan Road,
      Yuexiu District, Guangzhou,
      China 510180

      Map
    • 广州

      中国广州市越秀区
      中山六路236号
      越秀新都会大厦中座 23楼 B01室
      邮编510180

      地图
    • Shanghai

      Room B509, 5th Floor,
      48 Weihai Road,
      Huangpu District, Shanghai,
      China 200000

      Map
    • 上海

      上海市黄浦区
      威海路48号
      5楼B509室
      邮编200000

      地图
    • Shenzhen

      3/F, Block 5, Vision Shenzhen Business Park,
      9th Gaoxin South Road, 
      Shenzhen Hi-tech Industrial Park,
      Nanshan District, Shenzhen,
      Guangdong, China 518057

      Map
    • 深圳

      中国广东省深圳市
      南山区高新南九道
      威新软件园5号楼3楼
      邮编518057

      地图
    • Suzhou

      Building 12, Creative Industrial Park,
      328 Xinghu Street,
      Suzhou Industrial Park,
      Suzhou, China 215123

      Map
    • 苏州

      中国江苏省苏州市
      苏州工业园区星湖街328号
      创意产业园内12号楼
      邮编215123

      地图
  • Hong Kong

    • Hong Kong

      26F&17F, The Wellington Tower,
      198 Wellington Street,
      Central, HK

      Map
  • India

    • Bangalore

      Smartworks,  
      Global Technology Park,
      Block C, Outer Ring Rd,
      Adarsh Palm Retreat, Bellandur,
      Bengaluru, Karnataka 560103
      India

      Map
    • Hyderabad

      10, 11 & 12th Floors,
      Salarpuria Sattva Knowledge City,
      Plot No. 2, Phase - 1,
      Survey No. 83/1,
      Raidurgam Village,
      Serilingampally Mandal,
      Hyderabad, Telangana - 500081
      India

      Map
    • Pune

      SmartWork Business Center Pvt Ltd,
      Suite 8, Level 1,
      West Wing, Nyati Unitree,
      Samrat Ashok Road,
      Yerwada, Pune - 411006,
      Maharashtra
      India

      Map
  • Japan

    • Tokyo

      Floor 1-10-11
      Shibadaimon Centre Building 10th
      Shibadaimon Minato-ku
      Tokyo 105-0012
      Japan

      Map
      F: +81-03-6880-9201
  • Singapore

    • Singapore

      5 Shenton Way
      UIC Building, #10-01,
      Singapore (068808)

      Map
  • United Arab Emirates

    • Dubai

      EPAM Systems FZ-LLC Dubai Branch
      2307 Arenco Tower, Dubai Media City
      PO Box 501929 Dubai
      United Arab Emirates

      Map