Skip to content

Making End to End Tests

ADSKLowenthal edited this page Sep 14, 2015 · 3 revisions

End to End Testing

Also referred to as System Testing or E2E, allows you to test a fully integrated system or application. In this scope, E2E testing seeks to mimic user behavior and inspect the response presented through the web browser.

Protractor

Using Protractor it is possible to do E2E testing with Mean. It allows for direct browser manipulation through Selenium WebDriver, and is designed to integrate well with AngularJS based projects.

Requirements

  • Java - for running Selenium
  • Browser(s)
    • Chrome
    • FireFox
    • Others, though Chrome and FireFox are used by default

Writing Tests

E2E tests are written the same as other tests. The default setup is using jasmine so you'll have the familiar describe() and it() BDD style tests.

Here's a sample test that checks to ensure the title includes "MEAN":

describe('Smoke test home page', function(){
  it('title should contain MEAN', function(){
    browser.get('/');
    expect(browser.getTitle()).toMatch(/.*MEAN.*/);
  });
});

The core coding difference between these tests and unit tests is Protractor's inclusion of the browser object. It allows direct interaction with the web browser that's being tested.

Browser API

Clone this wiki locally