Developer Testing
-
Upload
chris-wallace -
Category
Technology
-
view
140 -
download
0
description
Transcript of Developer Testing
Developer Testing
Code Quality and You
If it builds, ship it
• Was young and foolish• Talk to a BA? QA? Never!• Just focused on writing code – not on quality
code• Bugs and bugs, oh my!
In all fairness
• Was young and naïve• “It worked on my machine”• Still a start-up with a start-up mentality where
the “Wild west” was accepted • But still there had to be a better way…
Ta-da!
Unit Tests
• Focuses on the smallest testable part of an application
• Independent
Unit Testing
• Cheap!• Finds problems early• Facilitates changes• Promotes decoupling• Living Documentation
Example Unit Test
Integration Tests
• Verifies functional, performance, and reliability– Do all the individual “units” work together?– Do all the combined “units” work in a performant
manner?– Do all the “units” work with external resources
and/or dependencies?
Integration Test Example
Acceptance Tests
• Higher-level tests that verify completeness of a user story
• Written in Gherkin:Given that I’m Product Owner,When the sprint ends,Then all of the stories should meet my requirements
• Highly collaborative between customers, Product Owners, BAs, QAs and Devs
Acceptance Tests
• A user story is not considered complete until the acceptance tests have passed
Acceptance Test Example
UI & Manual Tests
• Harder to automate• Still need to do exploratory testing
But what about…
• Regression Testing?– Rerun all of the tests we created previously
• Smoke Testing?– Rerun a subset of the tests we created previously
• Performance Testing?– Rerun a focused subset of the tests we created
previously with concurrency and load against a benchmark
Composition of the Tests
• Happy Paths• Sad Paths• “Woah, wasn’t expecting that” Paths
Testing Anti-Patterns
• But aren’t code reviews a substitute?• But we are near the end of Project XYZ; why
should we add tests now?• But couldn’t we “break” the code by adding
tests?• But it will take a longer time to complete• But our code-base is too large/complex to add
tests
Test Driven Development (TDD)
• Write a Test that fails• Write some code• Make all Tests pass• Refactor• Rinse and Repeat
Behaviour Driven Development (BDD)
• Write a Test* that fails• Write some code• Make all Tests pass• Refactor• Rinse and Repeat
*With a different purpose in mind; acceptance
TDD v BDD
• If I am doing BDD then do I need to do TDD or vice versa?– Absolutely!– TDD makes sure you are writing the thing right;
BDD makes sure you are writing the right thing
What about Code Reviews?
• Absolutely!• But the first question needs to be “show me
the passing tests”• Make sure we are getting better at writing
tests
The Who
• Quality is everyone’s responsibility– Devs– QAs– BAs– UX– Product Owners
The When
• During each sprint:– BA, Dev & QA all collaborating and following each
story to completion
• Today!
Developer Testing
• “How do I sell my executive team on doing this stuff? Don't. Just do it. They don't know what you're doing anyway” —Jim Highsmith