how to build an effective automated test suite
TRANSCRIPT
Thanks to our Sponsors!
To connect to wireless 1. Choose Uguest in the wireless list
2. Open a browser. This will open a Uof U website 3. Choose Login
How to build anEffective Automated
Test Suite
David Adsit@davidadsit
codeobsession.blogspot.com
Why test?
Why test?
“Code without tests is bad code. It doesn't matter how well written it is; it doesn't matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably.Without them, we really don't know if our code is getting better or worse.”
- Michael Feathers
3 Great Virtues
“We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris.”
- Larry Wall
The Full Test Suite
The Full Test Suite
Unit Tests
Integration Tests
Acceptance Tests
UI Tests
The Full Test Suite
Unit Tests
Integration Tests
Acceptance Tests
UI Tests
The Full Test Suite
Unit Tests
Integration Tests
Acceptance Tests
UI Tests
The Full Test Suite
Unit Tests
Integration Tests
Acceptance Tests
UI Tests
Unit Tests
Strengths▪ Fast - which means you can have a lot of them▪ Focused feedback when code breaks▪ Provide executable documentation for each unit
Weaknesses▪ Do not verify external dependencies▪ Do not verify that units will work properly together▪ Do not verify that the system supports desired features▪ Do not answer questions about the “-ilities” of the system
Integration Tests
Strengths▪ Verify that external dependencies behave as expected▪ Provide early notification of API changes▪ Facilitate changing external system providers▪ Can tell us about the “-ilities” of external dependencies▪ Help ensure clean boundaries with external dependencies
Weaknesses▪ Usually significantly slower than unit tests▪ Test only a very narrow part of the system▪ Do not verify that the system supports desired features
Acceptance Tests
Strengths▪ Help communicate features and requirements with business▪ Verify the existence of features▪ Help drive a clean API for the system▪ Exercise the full system (excluding the UI)
Weaknesses▪ Slower than unit tests▪ Do not answer questions about the “-ilities” of the system
The Double Loop
Layered Architecture
Eric Evans, Domain Driven Design
User Interface Tests
Strengths▪ Verify that the system can be assembled▪ Verify that the user can interact with the system▪ Can answer questions about the “-ilities” of the system
Weaknesses▪ Slower than the pitch drop experiment▪ Unreliable▪ Require significant maintenance when changes occur▪ Cannot provide confidence about system correctness
Questions
&
Demos
Links
Unit & Integration & Acceptance & UI:https://github.com/davidadsit/LegacyCodeRescue
Unit & Acceptance: https://github.com/davidadsit/bddtddfitnesse
Slides: http://www.slideshare.net/davidadsit
Blog Post:http://codeobsession.blogspot.com/2012/03/simpler-tests-what-kind-of-test-are-you.html
Final Questions?
David Adsit@davidadsit
codeobsession.blogspot.com