07. Testing and Mocking

While designing Prepare
Requirements Acceptance tests
System requirements System tests
Global design Integration tests
Detailed design Unit tests

Objectives

Testing shows the presence of bugs, not their absences.

Two main objectives:

Determine if it is fit for purpose:

Staged Testing

Run unit tests, then component tests, then system tests (scenario-based user testing).

Unit Testing

Methods should also prevent missuses:

Be skeptical:

Component Testing

Various types of interfaces:

Be skeptical of input data:

System Testing

Scenario-based testing:

Trace and record test executions in some structured way:

Agile Testing

For each commit run:

Peer reviews should also be done before merging.

Any successful builds should become a release candidate.

Run manual tests on candidate at end of each sprint.

Run automated performance tests before each release.

Assertion clauses:

Guideline-based testing identifies common programming mistakes (e.g. null values) and ensures tests are performed on these aspects.

Acceptance Test-Driven Development

User stories accompanied by acceptance criteria.

To automate the tests:

Automated Acceptance Tests

Use the same path as the users; playback tools like Selenium test directly on the GUI, but may be fragile and time-consuming.

Hence, decoupling the UI from business logic is useful.

Acceptance criteria can be tested using Cucumber.

Sprint Reviews

Prepare and plan sprint reviews:

Capacity, Load and Stress Testing

Quality requirements are often difficult to test (e.g. maintainability, auditability are not testable).

Capacity-focused requirements can be tested in a semi-automated fashion: response time can be expressed as user stories or as required system features.