E2e test instance _ angularjs in AngularJS

Source: Internet
Author: User
This article mainly introduces e2e testing instances in angularjs. This article uses Protractor to complete e2e testing. For more information, see ng unit testing in the previous article, today we will talk about e2e (end-to-end) testing.

When we test a single function point of a module, unit testing is the most suitable. However, when users encounter a bug when performing multiple page interactions, unit testing will not work, at this time, e2e is used to simulate user operations to restore the problem site. of course, e2e testing can also be used to test program robustness. Many tasks that cannot be done by unit testing can be done by e2e testing.

Previously, ng used Angular Scenario Runner to run e2e testing. Now it has been replaced with Protractor to run e2e.

Protractor

Protractor is the framework used to test e2e in Angularjs. It is an npm module and is built on WebDriverJS internally. Protractor can truly run your test cases on the browser, completely simulate the real user behavior.

The following are some of its resource addresses:

1. Test api provided by Protractor
2. Simple Example of Protractor
3. WebDriverJs guide, which is the core of Protractor dependency. The npm module is named selenium-webdriver.

How Protractor works

Protractor runs the e2e test on the following items:

1. WebDriver APIs, WebDriverJs mentioned above, is a js api provided by Selenium for front-end testing.
2. Selenium Server, a back-end jar package, used to communicate with the browser driver
3. WebDriver browser drivers is used to display the content of a real website and communicate with Selenium Server. This is where the actual browser operations are transmitted.

The entire running process is as follows:

Want to know

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.