5 - Syntax-Based Testing
from Part 2 - Coverage Criteria
Summary
In previous chapters, we learned how to generate tests from graphs, logical expressions, and partitions of the input space. A fourth major source for test coverage criteria is syntactic descriptions of software artifacts. As with graphs and logical expressions, several types of artifacts can be used, including source and input requirements.
The essential characteristic of syntax-based testing is that a syntactic description such as a grammar or BNF is used. Chapters 2 and 3 discussed how to build graph models and logic models from artifacts such as the program, design descriptions, and specifications. Chapter 4 discussed how to build a model of the inputs based on some description of the input space. Then test criteria were applied to the models. With syntax-based testing, however, the syntax of the software artifact is used as the model and tests are created from the syntax.
SYNTAX-BASED COVERAGE CRITERIA
Syntax structures can be used for testing in several ways. We can use the syntax to generate artifacts that are valid (correct syntax), or artifacts that are invalid (incorrect syntax). Sometimes the structures we generate are test cases themselves, and sometimes they are used to help us find test cases. We explore these differences in the subsections of this chapter. As usual, we begin by defining general criteria on syntactic structures and then make them specific to specific artifacts.
BNF Coverage Criteria
It is very common in software engineering to use structures from automata theory to describe the syntax of software artifacts.
- Type
- Chapter
- Information
- Introduction to Software Testing , pp. 170 - 212Publisher: Cambridge University PressPrint publication year: 2008
- 3
- Cited by