Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between Selenium Webdriver and angular e2e and when should each be used?

I need to test an angular application and I'm thinking which testing framework to use. Can someone please list the differences between those 2 testing framework, what is good / bad in each. when should each of them should be used? can the one replace the second?

Edit 1: I'll try to focus my question. what I'm really interested in is the technical abilities of the 2 frameworks. for example, some of the differences I have found:

  1. selenium webdriver has the ability to run on grid in parallel on multiple machines, on the other side, angular scenarios runs much faster than selenium.

  2. with selenium I can use keyboard keys such as Enter, Backspace and more and also do drag and drop actions.

  3. selenium is not dependent on the app technology, angular is for angular apps only

    Those are the type of differences I'm looking for - what can be done with one and can't be done with the other

thanks

like image 924
Tidhar Klein Orbach Avatar asked Apr 24 '13 05:04

Tidhar Klein Orbach


People also ask

What is Angular E2E?

End-to-end testing (E2E) of Angular applications is performed using the Protractor testing framework, which is created by the Angular team themselves. Protractor can perform end to end tests on Angular applications that are running in a real browser by interacting with it, similar to that of an end-user.

Can we use Selenium for Angular applications?

It is perfectly cloned from the Protractor features that are required to automate Angular applications using Selenium with Java. With the help of this library: No need to write extra JavaScript for Angular Requests Waiting. It provides new locating techniques to use Angular Specific Attributes.

Which automation framework is best for Angular application?

Protractor. This open-source framework automates end-to-end testing primarily for Angular and AngularJS applications. It works as an integrator of Selenium, WebDriver, Jasmine, NodeJS, and other technologies. That said, Protractor can also work well for regression testing with non-Angular apps.

What is Protractor E2E testing?

Protractor is an end-to-end test framework for Angular and AngularJS applications. Protractor runs tests against your application running in a real browser, using Selenium. We can say in other words that Protractor is a tool that helps us to test Angular Apps using Selenium.


2 Answers

Both should be used for testing an angular application. However, in my experience, they serve different purposes.

Angular e2e tests are your best friends when integrating new features into your application, or changing already existing features. They are there to make sure your application still behaves as expected if you are making changes to your code. These tests are much faster than selenium, do not need to be as in-depth, and, in my experience, are best executed before you push a new feature to your version control server.

Selenium tests should be used for regression testing. These tests should be far more in-depth than Angular e2e tests, and should be performed before pushing code into production.

like image 57
Shadowedged Avatar answered Oct 26 '22 18:10

Shadowedged


UPDATE: This question may be less relevant now. As of January 2014, Angular plans to move from their own E2E suite to the protractor library for function tests, which use Selenium Webdriver.

If you're starting a new Angular project, you may want to look into using Protractor, as it is going to replace the current method of E2E Testing in the near future.

(Source: http://docs.angularjs.org/guide/dev_guide.e2e-testing)


I am struggling with this question as well.

Here is my thinking today:

1) Use Angular e2e testing for integration/regression testing the UI with mocks of your external dependencies (like the app server).

2) Use Selenium for integration/regression testing the complete system in a test/qa environment.

It seems Angular e2e testing helps fill in the gaps that unit testing leaves in testing view and controller logic that is tied to UI events. All of the Angular tests should mock external dependencies.

Selenium seems like the best fit for testing the entire system as the user will experience it.

like image 45
Steve Jansen Avatar answered Oct 26 '22 17:10

Steve Jansen