Structure of JSON TestCases
In addition to the Modules that you create by scanning, you can also use Modules from the Standard subset in your JSON Engine 3.0 TestCases. You can find the following Modules under Standard modules->TBox XEngines->JSON:
In your TestCases, you can add, edit, or verify all elements listed in the table "Business-based control types":
-
Insert: add new JSON elements.
-
Input: modify existing elements.
-
Verify: verify values. Properties of control types are specified in the Value column for editing.
Verify the occurrence of an element
The property Exists verifies whether an element occurs in a JSON file or not. The value is True or False accordingly. The ActionMode is Verify.
The JSON file books.json is loaded into the resource json. The task is to verify whether the element title occurs in the JSON file which contains the element lang with the value en, and the element text with the value Everyday Italian.
Verifying the existence of a JSON element |
Examples
The TBox package contains sample Modules and TestCases for JSON. Some of these examples are described in this chapter.
Before executing the TestCases, the test configuration parameter ExampleDirectoryJSON must be defined. The directory to be used for saving the JSON files during test execution must be specified.
The created JSON files are saved to the directory D:\JSON examples in this example.
Test configuration parameter ExampleDirectoryJSON |
Boolean values
In the example below, the TestCase Boolean is described in greater detail.
Example - Boolean values |
Numbers
In the example below, the TestCase Number is described.
Example - Numbers |
String values
In the example below, the TestCase String is described.
Example - String |
Arrays
In the example below, the TestCase Full array is described in greater detail.
Example - Array |