Sections


Test case script

As we have seen in our example, a typical test case script contains 4 sections, including 1 Metadata section and 3 execution phases :

Label Occurrence
METADATA : optional
SETUP : optional
TEST : exactly one
TEARDOWN : optional

Note that the space-columns ’ :’ are part of the label. A script must contain exactly one ‘TEST :’ phase and may contain up to one ‘METADATA :’ section, and up to one ‘SETUP :’ and/or ‘TEARDOWN :’ phase. The phases may be declared in any order, but the ‘METADATA :’ section must come first. When a label is declared, no other element is allowed on the same line.

A section begins with a label and ends when another label begins or when the end of file is reached. Instructions must be placed within the boundaries of a section, and any instructions out of a section (mainly when placed before the first label) will cause an error and stop the processing.

Correct test script structure

METADATA :

//a comment

key1 : value1

key2 : value2

SETUP :

//another comment

an instruction

another instruction

TEST :

some instructions

//another comment

lots of instructions…

TEARDOWN :

more instructions

//other comment

and a last instruction

Minimal test script structure

TEST :

An instruction

Another instruction

Some more instructions…



Metadata section

Declaration

This section can be declared by writing “METADATA :” in a typical Squash Test script, not in an Ecosystem one.

In fact, a typical Test script may or may not contain a Metadata section. However, this section, if any, must be unique. The Metadata section must also be placed before any execution phases (SETUP, TEST or TEARDOWN).

Content

A Metadata section can contain only empty lines, comment lines and, of course metadata lines. While an empty line must contain nothing or only spaces/tabulations and a comment line must start with the symbol ‘//’, a metadata line is always 1 of these 3 types :

  • key
  • key : value
  • : value (allowed only after a metadata line of second type)

The symbol ‘:’ is the separator, used between a metadata key and its value.

Note

Spaces/tabulations between the separator and its key or/and value are not mandatory but strongly advised.

Metadata key

A metadata key can contain only alphanumeric characters, dashes, underscores and dots, and stops at the first space/tabulation found or at the end of the line. Moreover, no inline space/tabulation is allowed before a metadata key.

Metadata key is case insensitive and must be unique in a Test file.

Metadata value

A metadata value is always placed after a separator “:”. It can contain alphanumeric characters, dashes, underscores, dots and slashes, and stops at the first space/tabulation found or at the end of the line.

Metadata value is case sensitive and must not be empty (i.e. there must be at least a letter/character after the separator “:”).

A metadata value must be assigned with a metadata key. If a key has more than one values, the first value will be written with its key as: “key : value”. Other values will be declared of type : “[space/tabulation] : value”.

Important

Between “key : value” line and its following “: value” lines, comment lines are allowed, but NOT empty lines.