Test Pragmas
This document is reference for AG350 Test Pragmas. The AG350 Test Pragma format is a mechanism for communication information about a test such as events, assertions, and additional data. This pragma format can be consumed by a variety of AG350 consumers, most notably the Athena build system.
#
Pragma Types#
@ag350:test:startIndicates the start of a test.
#
@ag350:test:endIndicates the end of a test.
#
@ag350:assertion:startIndicates a start of an assertion. A start assertion pragma must be between a test start and test end pragma.
#
@ag350:assertion:endIndicates the end of an assertion. A end assertion pragma must be between a test start and test end pragma and after an assertion start pragma.
#
@ag350:assertion:dataIndicates assertion data. An assertion data pragma must be between an assertion start and assertion end pragma. An assertion data pragma must include a valid json object following the "@ag350:assertion:data" text. This json object must have a name for the assertion (preferably unique within the test) and a status (either "PASS" or "FAIL"). In addition to these required fields this assertion data can include any desired key-value pairs that may be useful information to associate with the assertion.
Ex:
@ag350:assertion:data { "name": "Example assertion", "status": "FAIL", "expected": 1, "value": 2, "time": "2s" }
#
Pragma FormatPragmas can be read from any text output or form. When a collection of pragmas are included in an output the output is considered to be in a "pragma format."
The pragma format have the following properties:
- Each pragma must be on its own line.
- The pragma format is forgiving - non-pragma data can be included amongst pragmas so long as pragmas are on their own line.
#
Examples#
Correct1. A test with a single pass assertion.
2. A test with two assertions (one pass, one fail). Notice, the pragma format is forgiving, allowing text that are not pragmas.
#
Incorrect1. No test start pragma.
2. No test end pragma.
3. Assertion data is not valid json.
4. No assertion start and end pragma.