Not about testing!
Not talking about a release cycle here (days/weeks/months).
Fast cycle while we’re writing the code (seconds/minutes).
Important step!
Refactoring means improving the designwithout changing behaviour (eg removing duplicated code).
TDD allows you to design incrementally, while only implementing what’s needed.
Separate talk later.
“Traditional” process.
Looks linear, but problems will be found in design and implementation.
Reduce the amount of time it takes to test by automating.
From now on, whenever anyone says “test”, you can generally assume they mean “automated test”.
Writing the tests first forces us to think about what each piece of code has to do.
Still needs the design to have been decided up-front though.
Now we have that TDD loop.
Run tests first to make sure they fail correctly, with useful messages.
Definition of BDD has changed over time.
From Uncle Bob Martin
(that’s not one of the rules)
“Black box”. Does the whole system work as required?
Generally means testing through the user interface.
Tend to be slow, so you don’t want many of them.
Test classes along with their collaborators.
May hit things like databases.
Faster than system tests, but can still be slow.
Can be brittle – changes to a collaborator can break unrelated test.
Give confidence that things are wired together right.
Genuine unit tests – test a single class, with test doubles standing in for collaborators.
Fast and isolated.
We’ll cover test doubles tomorrow.
Generally acceptance tests are more likely to be system or integrated tests, but they don’t have to be (eg validation rules).
Fewer slow system tests at the top. Mostly fast unit tests.
Arrange/act/assert
Given/when/then
Ignore the syntax.
Name tests well.
No need for repetitive manual testing – can concentrate on exploratory testing.
You get used to assuming high test coverage – gives confidence.
Yes – at the small scale fo individual changes.
Much less debugging.
Vastly reduced design/test phases.