A test case design technique for a component or system in which test case design is based upon the syntax of the input.
Syntax testing, also called grammar-based testing, is a powerful black box, data-driven testing technique for testing applications where the input data can be described formally. Originally developed to help test compilers and language processors, syntax testing can also be used in applications that are more mundane.
Here are some possible domains:
- GUI applications. GUI applications typically involve user interaction via dialog boxes. These dialogs often have data fields (e.g. date, phone number, social security number) that have a precise syntax.
- XML/HTML files. All XML/HTML files have a precise structure with well-defined tags. Such a structure is amenable to formal specification.
- Command-driven software. These are among the common applications that benefit from syntax testing. Shell scripts and non-GUI applications that take command line arguments are examples.
- Scripting languages. Some commercial applications are bundled with support for a scripting language such as Perl, Python, VBScript, and so on. These scripting languages have a precise, formally expressible syntax.
- Database query languages. Database query languages such as SQL can be described by a formal grammar.
- Compilers. Testing compilers is a formidable task due to the size of the input space. Since the compiled language has a precise grammar, it should be feasible to use the syntax specification to generate test cases, just as it is used for syntax validation.