;doc: contributing: kent beck tests properties

[ci skip]
This commit is contained in:
Simon Michael 2019-10-21 13:37:35 -07:00
parent 312e772468
commit e0c511b5fc

View File

@ -673,6 +673,24 @@ About testing in the hledger project, as of 201809.
### Kinds of tests ### Kinds of tests
<div style="margin:1em 2em; font-style:italic;">
"Here, then, is a list of properties of tests. Not all tests need to exhibit all properties. However, no property should be given up without receiving a property of greater value in return.
- Isolated — tests should return the same results regardless of the order in which they are run.
- Composable — if tests are isolated, then I can run 1 or 10 or 100 or 1,000,000 and get the same results.
- Fast — tests should run quickly.
- Inspiring — passing the tests should inspire confidence
- Writable — tests should be cheap to write relative to the cost of the code being tested.
- Readable — tests should be comprehensible for reader, invoking the motivation for writing this particular test.
- Behavioral — tests should be sensitive to changes in the behavior of the code under test. If the behavior changes, the test result should change.
- Structure-insensitive — tests should not change their result if the structure of the code changes.
- Automated — tests should run without human intervention.
- Specific — if a test fails, the cause of the failure should be obvious.
- Deterministic — if nothing changes, the test result shouldnt change.
- Predictive — if the tests all pass, then the code under test should be suitable for production."
--[Kent Beck](https://medium.com/@kentbeck_7670/test-desiderata-94150638a4b3)
</div>
1. Unit tests 1. Unit tests
Unit tests exercise small chunks of functionality. In hledger, that Unit tests exercise small chunks of functionality. In hledger, that