From Requirements To Test Cases

Program testing can be used to show the presence of bugs, but never to show their absence!
- Edsger Dijkstra

This chapter provides a base of knowledge aimed to help software engineers to write meaningful test cases. The starting point for this process is the understanding of the requirements of the system being tested. Without that information, it is not feasible to design nor implement valuable tests. After that, several actions might be executed before the actual coding of the tests, namely, test planning and test design. Once we start the test coding process, we need to have in mind a set of principles to write code right, and also a set of anti-patterns and bad smells to be avoided. All this information is provided in this chapter in form of the following sections:

  • The importance of requirements: This section provides a general overview of the software development process, started by the statement of some needs to be covered by a software system, and followed by several stages, typically including analysis, design, implementation, and tests.
  • Test planning: A document called test plan can be generated at the beginning of a software project. This section reviews the structure of a test plan according to the IEEE 829 Standard for Test Documentation. As we will discover, the complete statement of a test plan is a very fine-grained process, especially recommended for large projects in which the communication among the team is a key aspect for the success of the project.
  • Test design: Before starting the coding of the tests, it is always a good practice to think about the blueprint of these tests. In this section, we review the major aspects to be taken into consideration to design properly our tests. We put the accent on the test data (expected outcome), which feed the test assertions. In this regard, we review some black-box data generation techniques (equivalence partitioning and boundary analysis) and white-box (test coverage).
  • Software testing principles: This section provides a set of best-practices which can help us write our tests.
  • Test anti-patterns: Finally, the opposite side is also reviewed: what are the patterns and code smells to be avoided when writing our test cases.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.26.108