This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
software_carpentary2 [2011/06/20 03:48] medhamsh |
software_carpentary2 [2011/06/20 03:53] medhamsh |
||
---|---|---|---|
Line 50: | Line 50: | ||
* You can't test without some sort of specification | * You can't test without some sort of specification | ||
+ | |||
+ | |||
+ | ===== Writing Tests ===== | ||
+ | How to write tests so that: | ||
+ | * It's easy to add or change tests | ||
+ | * It's easy to see what's been tested, and what hasn't | ||
+ | |||
+ | A test consists of a fixture, an action, and an expected result | ||
+ | o A fixture is something that a test is run on | ||
+ | o Can be as simple as a single value, or as complex as a networked database | ||
+ | Every test should be independent | ||
+ | o I.e., the outcome of one test shouldn't depend on what happened in another test | ||
+ | o Otherwise, faults in early tests can distort the results of later ones | ||
+ | So each test: | ||
+ | o Creates a fresh instance of the fixture | ||
+ | o Performs the operation | ||
+ | o Checks and records the result | ||
+ | |||
+ | Find the exercises at http://software-carpentry.org/3_0/qa.html |