Syntax Testing

What is Syntax Testing?

Syntax Testing is a type of black box testing technique which is used to examine the format and the grammar of the data inputs used in the software application, either external or input, which may be formally described in technical or established & specified notations such as BNF and could be used to design input validation tests.

Syntax testing is performed to verify and validate the both internal and external data input to the system, against the specified format, file format, database schema, protocol and other similar things. Generally, syntax tests are automated, as they involve the production of large number of tests.

How to perform syntax testing?

The methodology of syntax testing can be perceived and understood through following steps in the sequential order:

  • The very first step of the syntax testing involves the identification of the target language or format.
  • Thereafter, syntax of the language is defined, as specified in the formal notation. As each and every input has some syntax, which may be formally pre-specified, undocumented, etc.
  • The final step involves testing and debugging the syntax to ensure its completeness & consistency. Generally, the syntax is tested using two conditions as stated below.
    • Testing the normal condition using the covering set of paths of the syntax graph, for the minimum necessary requirements.
    • Testing the garbage condition*, using invalid set of input data.

    Note*: Garbage condition is the method of testing the system's tolerance against the bad or dirty data. The condition is executed by providing dirty data (invalid data) to the system, which is being not supported by the specified format and grammar of the syntax.

    What Test Strategy needs to be followed in Syntax Testing?

    The preferred test strategy which may be followed up to perform syntax testing is to create one error in the input string, one at time while keeping all other components of the string unchanged and correct. Thereafter, the said process needs to repeat until the complete set of test for the single errors get defined. Similarly, the complete set of test for the double error, triple error and so on may be defined and designed. During the whole process, the focus should be at one level, along with the correctness both at its upper and lower level.

    Limitations Of Syntax Testing

    • Likely to miss or forget the normal test cases.
    • Syntax testing needs the development of driver, a separate program, to automatically go through each of the test cases available as a data set.