![]() The canonical purpose of a unit test is to focus rigidly on a single piece of code, with every invocation of code external to the unit mocked out, preferably by a mocking framework like mockito or jmockit. ![]() Coupled with good mutation testing coverage, it’s an invaluable tool to ensure that any change which makes your software produce different output will result in a failed test. A good unit test is the canary in the coal mine of evil coding. A key benefit however of working this way is that it strengthens your understanding of the code under construction, invites you to seek out edge cases and protects you against yourself by making it hard to cut corners since badly designed code is often hard, if not impossible to test. A most noble principle, although in practice it’s likely to proceed more hand in hand. In test-driven design (TDD) writing test assumptions should precede writing production code. Unit tests: solitary and limited by design There are many methods to test and not all aims listed above apply equally (or at all) to each method at our disposal. ![]() In short: tests lessen the risk that your product is going to make the customer angry or unhappy.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |