how to build an effective automated test suite

19
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

Upload: david-adsit

Post on 17-Jul-2015

137 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: How To Build an Effective Automated Test Suite

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

Page 2: How To Build an Effective Automated Test Suite

How to build anEffective Automated

Test Suite

David Adsit@davidadsit

codeobsession.blogspot.com

Page 3: How To Build an Effective Automated Test Suite

Why test?

Page 4: How To Build an Effective Automated Test Suite

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

Page 5: How To Build an Effective Automated Test Suite

3 Great Virtues

“We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris.”

- Larry Wall

Page 6: How To Build an Effective Automated Test Suite

The Full Test Suite

Page 7: How To Build an Effective Automated Test Suite

The Full Test Suite

Unit Tests

Integration Tests

Acceptance Tests

UI Tests

Page 8: How To Build an Effective Automated Test Suite

The Full Test Suite

Unit Tests

Integration Tests

Acceptance Tests

UI Tests

Page 9: How To Build an Effective Automated Test Suite

The Full Test Suite

Unit Tests

Integration Tests

Acceptance Tests

UI Tests

Page 10: How To Build an Effective Automated Test Suite

The Full Test Suite

Unit Tests

Integration Tests

Acceptance Tests

UI Tests

Page 11: How To Build an Effective Automated Test Suite

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

Page 12: How To Build an Effective Automated Test Suite

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

Page 13: How To Build an Effective Automated Test Suite

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

Page 14: How To Build an Effective Automated Test Suite

The Double Loop

Page 15: How To Build an Effective Automated Test Suite

Layered Architecture

Eric Evans, Domain Driven Design

Page 16: How To Build an Effective Automated Test Suite

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

Page 17: How To Build an Effective Automated Test Suite

Questions

&

Demos

Page 18: How To Build an Effective Automated Test Suite

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

Page 19: How To Build an Effective Automated Test Suite

Final Questions?

David Adsit@davidadsit

codeobsession.blogspot.com