12. Good arguments for that
● Finite time for writing tests
● Maintaining test code is expensive
● I’m just not that creative
13. How hard do you test edge cases?
● Test with Unicode most days?
● Insert control characters into strings?
● Throw negative values at your numbers?
● Toss empty containers at utility functions?
● Combine multiple edge cases in one test?
14.
15. Typical Unit Testing Flow
1. You provide code of questionable quality
2. You provide input values to your functions
3. You hope not comically misrepresentative
4. You use the values to do something useful
5. You verify useful thing has expected result
23. Typical Unit Testing Flow
1. You provide code of questionable quality
2. You provide input values to your functions
3. You hope not comically misrepresentative
4. You use the values to do something useful
5. You verify useful thing has expected result
24. Enter Property Testing
1. You provide code of questionable quality
2. You provide specification of kinds of inputs
3. It provides values to kick your butt
4. You use the values to do something useful
5. You verify useful thing has expected result
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53. When to Use Property Tests
● Not always
● Natural round-tripping, symmetric functions
o Serialization/Deserialization
o Protocols
● Two equivalent algorithms
● Natural invariants
● General utility functions
o May need to resort to heuristic
54. What’s not to Like?
● Relatively slow to execute
● More to to get a basic level of coverage
● Documentation tends to be thin
55. Can I Use Property Testing?
● Scala
● Haskell
● JavaScript
● Ruby
● Python
● C# and .NET
● Java
● Closure
Others too!
From this old list