End to end testing with protractor

Blog > End to end testing with protractor

Nowadays, software systems are complex and connected to too many subsystems. Even just an error
in the subsystem affects the entire system and causes the software to not work as expected. This is a
great risk and can be prevented by end-to-end testing.
Protractor is an end to end test framework which simulates user actions that will help you verify the
workability of your Angular based applications. It runs tests in a real browser. Even though its
prefered use is for performing end to end testing in Angular and AngularJS applications, it can also
be used for non-Angular applications.
With this writing, I will try to explain to answer these questions such as What is E2E? How to create
E2E Test Cases?, Why choose a protractor?

What is End-To-End Testing?

End to end testing is a software testing method that is used to test the entire software from
beginning to end by copying user actions so that an application can be verified for
functionality. It also provides to test from the experience of the end user by validating the
system under test and its components for integration and data integrity.

How to create End-to-End Test Cases?

End to End Testing Design framework must consist the following three parts:

1.Build User Functions:

Following activities should be done to build user functions;
  ● List the features of the software and its interconnected subsystems.
  ● List the all input and output data for each feature or function
  ● Identify the relationships between the functions
  ● Determine whether the function can be reusable or independent
For example -Consider a scenario where you create a new social media account;

  1. Navigate to the social media application with its URL
  2. Create a new user account
  3. Login to the application with the credentials
  4. View the profile
  5. Logout from the application

2.Build Conditions:

Following activities should be considered to build test conditions;
  ● Determine a set of conditions for each user functions
  ● Conditions include sequence, timing and data conditions
For example -Checking conditions;

  1. Invalid Username and Password
  2. Checking with valid username and password
  3. Password strength checking
  4. Checking of error messages

3.Build Test Cases:

Following activities should be considered to build test cases;
  ● Multiple test cases should be created to test every functionality of the user functions.
  ● Every condition should be enlisted as a separate test case.
Building the Test Cases for the user function defined;

  1. Navigate to the social media application with its URL
  2. Create a new user account
  3. Login to the application with valid username and password
  4. View the profile
  5. Logout from the application

Why Protractor?
*One of the best sides of the protractor is that it is open source. Also UI tests can be made
simply and quickly by protractor.
*Protractor uses Selenium grid, so parallel tests across different machines and different
browsers are run simultaneously, thus execution time is minimized.
*Protractor supports Angular-specific locator strategies including binding, model,repeater
which allows you to test Angular-specific elements without any setup effort.
*Protractor is a test framework that is prefered by many people so if they have any problem
when testing with protractor, they can find solutions with research on a lot of sources.
*Protractor runs tests against in real browser hence real user actions can be replicated.
* Protractor is important for testing of Angular-based applications and it works as a solution
integrator combining powerful technologies like Selenium, Jasmine, WebDriver, etc.

If you want to learn ‘how does protractor work?’ and get more detail about Protractor, you
can visit this link;
https://www.youtube.com/watch?v=KeXlvJk__nk

Sources:
https://www.guru99.com/end-to-end-testing.html
https://medium.com/@Synerzip/test-automation-for-angular-apps-using-protractor-
c7b2d3af2150
https://medium.com/swlh/angular-end-to-end-testing-with-protractor-55897de591be

Tags