Test scenario syntax

You can use the test scenario syntax to load multiple entity loader and submit multiple event sequence files from a single test file. You can also write tests that can help you check entities and their values.

Purpose

Test scenarios are stored in the Test Scenario folder in the test client project. You create a test scenario to run a set of entity loader and event sequence files to a test server. You can also verify that an entity exists and check the value of the attributes of an entity.

Syntax

The following syntax shows the constructs that you can use when you write a test scenario.

[using definitions from "<entity loader file>" ;]
[load entities from "<entity loader file>" ;]
[load entities from:
 - "<entity loader file>" ;]

[submit events from "<event sequence file>";]
[submit events from :
   - "<event sequence file>" ;]
[continue processing until <date> ;]
[check that <entity> <exists/does not exist> ; ]
[check that for <entity> [identified by <entity id>] : 
   - <list of tests> ; ]
Table 1. Optional constructs for test scenarios
Construct Description Example

check that <entity>exists/does not exist

Detects the existence or absence of a specific entity.

check that milk exists ; 

check that for <entity> : <list of tests> ;

Verifies the expected results of a list of tests on a specified entity. This construct checks that the values of your entity correspond to the values expected in your list of tests.

check that for the customer "Betty" :
   - the name of this customer is "Betty"
   - the occupation of this customer is "Software Architect" 
   - the address of this customer is not null ; 

check that for <entity> identified by <entity id> <list of tests> ;

Verifies the expected results of a list of tests. This construct checks that the values of entities that have IDs correspond to the values that you expect from your list of tests.

 check that for the customer identified by customerName :
   - the name of this customer is "Betty"
   - the occupation of this customer is "Software Architect"
   - the address of this customer is not null ;

load entities from "<entity loader file>" ;

Loads entities from a single entity loader file.

load entities from "customer" ; 

load entities from: - "<entity loader file>" ;

Loads entities from a list of entity loader files.

load entities from: 
   - "customers"
   - "accounts" ; 

submit events from "<event sequence file>" ;

Submits events from a single event sequence file.

submit events from "purchases" ; 

submit events from: - "<event sequence file>" ;

Submits events from a list of event sequence files.

submit events from: 
   - "purchases"
   - "returns" ; 

continue processing until <date>

Simulates the passing of time from the date of the last event in an event sequence to the date and time that you define in the continue processing until <date> construct.

continue processing until 13/10/2016 11:10:00 PM ;

using definitions from: -"<common definitions file>" ;

Specifies the common definitions file or files from which an entity loader, event sequence, or common definitions file uses the definitions. When you use this construct, it must be used in the header of the file and precede all of the other constructs.

using definitions from: 
   - "customer_ids"
   - "items" ; 

Example

In the following example, the scenario file includes two entity loader files that are named customer_ids and items, and an event sequence file named purchases.

load entities from:
   - "customer_ids" 
   - "items" ;

submit events from "purchases" ;

check that pencil exists ;
check that for the customer identified by "Betty" : 
   - the age of this customer is between 18 and 65
   - the address of this customer is not null
   - the phone number of this customer is not null ;