A simple practice like Test-Driven Development provides us with a lot techniques and patterns. How can we find a good balance in all these approaches?
The world of automated tests can be quite overwhelming. Tests exist in a wide variety of flavours, like unit tests, integration tests, API tests, database tests, acceptance tests, UI tests, performance tests, regression tests, smoke tests, etc. … All of these have their usefulness for the specific purpose that they are serving. However, they can all be broken down into two broad categories: Solitary and Sociable tests. These can be seen as the equivalent of tests that either run very fast, and tests that have a wider variety of slowness.
When zooming in further on Solitary Tests specifically, we find that there are generally two different types of verification: state verification and behaviour verification. How and, most importantly, when should we apply these types of verification? There’s a lot to learn about a seemingly simple practice as Test-Driven Development. In this workshop we’re going to discover why it’s important to find a balance in TDD and how to accomplish this.
This workshop is for developers who already have experience writing automated tests and want to improve upon their existing skills in writing unit and integration tests. By the end of this workshop, participants will have gained the knowledge necessary to build loosely coupled, highly maintainable and robust tests that are trustworthy and improve the overall code quality of your software applications.
Part 1 - The Automated Testing Landscape
- Solitary and Sociable Tests
- The Test Pyramid
- Exercise 1-1 - State and Behaviour Verification
Part 2 - The Anatomy of Automated Tests
- Arrange, Act, Assert
- DRY & DAMP
- AAA Per Test Method
- AAA Per Test Class
- Naming tests
- Exercise 1-2 - The Anatomy of Unit Tests
Part 3 - State Verification
- Test Data Builder
- Exercise 1-3 - Test Data Builder
- Single Assert per Test
- Procedural vs Object State Verification
- Exercise 1-3 - State Verification
Part 4 - Behaviour Verification*
- Indirect Inputs & Outputs
- Test Doubles
- Fixture Object
- Exercise 1-4 - Fixture Objects