Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Common Path for
Approval Testing
patterns for more powerful asserts
@LlewellynFalco
English
CodeResult
Whiteboard
// Create side (0,0) – (3,4)
// Verify length
Side s = new Side(0,0,3,4);
Approvals.Verify(s...
1) Numbers
// verify 2 names
assert(2, names.length)
Easy
Simple
1) Numbers
// verify names
assert(5, names.length)
assert(“Llew”, names[0])
assert(“Woody”, names[1])
assert(“Jim”, names[...
1. Specification
2. Feedback
3. Regression
4. Granularity
2) Strings
// verify names
Assert(
“[Llew, Woody, Jim, Jason, Dan]”,
names.toString())
More expressive
Objects, Tests & Lo...
2) Strings You’ll start to want
more…
// verify names
Assert(
“[Llew, Woody, Jim, Jason, Dan]”,
names.toString())
3)
// verify json
Assert(
“{age:12,
name:Tom,
address: 123 fake st}”,
tom.toString())
Easy to test bigger
concepts
Long
st...
3)
// verify xml
Assert(
“<xml><person>nt<name>tom<name>n
t<age>”13”<age>nt</person>”,
tom.toString())
Can get very bigLon...
4) Files
// verify companies as xml
assertFileContains(
“expected.companylist.xml”,
report.toString())
Less Clutter
Can us...
4) Files
// verify companies as xml
assertFileContains(
“expected.companylist.xml”,
report.toString())
Lots of filenames
C...
5)
// verify companies as xml
Verify(report)
Convention over
configuration
Code
starts to
become
trivial
Automatic
names
5)
// verify companies as xml
Verify(report)
What went wrong?
Automatic
names
Slow
Do
Verify Pass
Increase
Feedback
Fail
See the forest
& the trees
Files not
limited to
text
6) Diff Tools
Can render
html, svg, etc…
(on failure)
Duplication
in the tests6) Diff Tools
On failure
event is
pretty basic
(on failure)
Testing gets
easier & easier7)
Custom Test
Methods
MapReduce.verify(…)
Wpf.verify(…)
Xml.verify(…)
Routing.verify(…)
Tests...
1. Numb3rs
2. “Strings”
3. “VeryrnLongrnStrings”
4. Files.txt
5. AutomaticNames()
6. DIFF TOOLS DIFF T00LS
7. Test.CustomV...
Upcoming SlideShare
Loading in …5
×

Approval testing from basic to advanced

867 views

Published on

The path to better testing
Numb3rs
“Strings”
“Very\r\n\Long\r\nStrings”
Files.txt
AutomaticNames()
DIFF TOOLS DIFF T00LS
Test.CustomVerify()

Published in: Software
  • Be the first to comment

Approval testing from basic to advanced

  1. 1. Common Path for Approval Testing patterns for more powerful asserts @LlewellynFalco
  2. 2. English CodeResult Whiteboard // Create side (0,0) – (3,4) // Verify length Side s = new Side(0,0,3,4); Approvals.Verify(s + “ length = “ +s.Length); Side (0,0) – (3,4) length = 5 Testing Circle
  3. 3. 1) Numbers // verify 2 names assert(2, names.length) Easy Simple
  4. 4. 1) Numbers // verify names assert(5, names.length) assert(“Llew”, names[0]) assert(“Woody”, names[1]) assert(“Jim”, names[2]) assert(“Jason”, names[3]) assert(“Dan”, names[4]) Can get complicated I have to change my Scenarios to make it work
  5. 5. 1. Specification 2. Feedback 3. Regression 4. Granularity
  6. 6. 2) Strings // verify names Assert( “[Llew, Woody, Jim, Jason, Dan]”, names.toString()) More expressive Objects, Tests & Logs Can use your normal Scenarios
  7. 7. 2) Strings You’ll start to want more… // verify names Assert( “[Llew, Woody, Jim, Jason, Dan]”, names.toString())
  8. 8. 3) // verify json Assert( “{age:12, name:Tom, address: 123 fake st}”, tom.toString()) Easy to test bigger concepts Long strings
  9. 9. 3) // verify xml Assert( “<xml><person>nt<name>tom<name>n t<age>”13”<age>nt</person>”, tom.toString()) Can get very bigLong strings Line endings Scoping Matters can != should
  10. 10. 4) Files // verify companies as xml assertFileContains( “expected.companylist.xml”, report.toString()) Less Clutter Can use your normal Scenarios
  11. 11. 4) Files // verify companies as xml assertFileContains( “expected.companylist.xml”, report.toString()) Lots of filenames Creating The files
  12. 12. 5) // verify companies as xml Verify(report) Convention over configuration Code starts to become trivial Automatic names
  13. 13. 5) // verify companies as xml Verify(report) What went wrong? Automatic names
  14. 14. Slow Do Verify Pass Increase Feedback Fail
  15. 15. See the forest & the trees Files not limited to text 6) Diff Tools Can render html, svg, etc… (on failure)
  16. 16. Duplication in the tests6) Diff Tools On failure event is pretty basic (on failure)
  17. 17. Testing gets easier & easier7) Custom Test Methods MapReduce.verify(…) Wpf.verify(…) Xml.verify(…) Routing.verify(…) Tests give high Return on Investment
  18. 18. 1. Numb3rs 2. “Strings” 3. “VeryrnLongrnStrings” 4. Files.txt 5. AutomaticNames() 6. DIFF TOOLS DIFF T00LS 7. Test.CustomVerify()

×