Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

As the frontend is an Angular.io application (which uses Angular CLI), we follow the best practices for Testing. This includes concentrating our effort on Unit tests (specs) over Integration / end-to-end (e2e) tests per this section of the Angular testing guide. 

Technologies used

  • Jasmine for writing unit/spec tests and Karma for running those tests
  • Protractor for writing integration / end-to-end (e2e) tests
  • Travis CI - This is our continuous integration system of choice. It automatically runs all code style checks & unit/integration tests for all Pull Requests. Our configuration for Travis CI can be found in our .travis.yml
    • Our Travis configuration also starts up a Docker-based REST API backend for running end-to-end (e2e) tests against.
  • Coveralls - Travis CI runs test code coverage checks which it passes to Coveralls.io for easier display/analysis. If Coveralls finds code coverage has decreased significantly (which means tests were not implemented for new code), it will place a warning on a Pull Request.

...

Writing Integration (e2e) Tests

...

A few quick guidelines on writing Angular end-to-end (e2e) tests using Protractor (and Jasmine):

  • All e2e tests should be in the /e2e/src/ directory, per the Angular CLI best practices

Writing Unit (spec) Tests

A few quick guidelines on writing Unit (or spec) Angular tests using Jasmine:

  • Specs are required for all Angular Components
  • All specs should be placed in the same directory as the Angular Component which they test. The filename should end in ".spec.ts".  For example, the login-page.component.ts has a corresponding login-page.component.spec.ts test file.
  • As much as possible/reasonable, follow the Angular Testing Guide, which provides detailed example tests.  Jasmine also has good documentation/tutorials on learning to write tests.