Skip to content
This repository was archived by the owner on Jun 21, 2020. It is now read-only.

Test Strategy

rjarrattmsft edited this page May 13, 2017 · 5 revisions

Test Strategy

Behavioural Tests

These are tests that verify the behaviour of the service and are written using Spec Flow. They are the prime tests used to verify that the system operates as expected. Given that the behaviour is exposed as a web api, then the behavioural tests operate by invoking the controller.

Clearly the controller needs to work against the external environment, however we want the behavioural tests to run in the build so that we do not deploy broken behaviour. This is achieved by using the Repository pattern. We implement two repositories using the same interface, one emulates the environment and one is the real repository that actually interacts with the real environment. The two repositories are tested by a single set of tests to ensure that they both implement the same contract, the emulator tests run as part of the unit test suite and the real repository tests run as the integration tests.

Behavioural tests therefore operate in two modes. In the build they are set up to use the emulated repositories. In the integration environment tests they are set up to use the real repositories.

Integration Tests

These test the real repositories and can only run in the integration environment.

Unit Tests

Unit tests are tests that can run in an environment-independent manner, in the sense that they are entirely self-contained and do not require any kind of environment setup. They can run on developer machines and build servers. Unit tests are run in every build. They could be run in the release environments too, but there is not much point in doing so.

We only use unit tests where the behavioural tests do not provide coverage. Typically this would be for "library" code. We also use them to test the emulated repositories, using the same test suite as the integration tests that test the real repositories.

Smoke Tests

These tests verify that the service is actually hosted correctly and ready to use (including any external dependencies). The service must expose an endpoint that allows its health to be checked and can be used as part of an Application Insights availability test.

Clone this wiki locally