Creating event sequences
You define a set of test events in an event sequence. The events that you emit are sent to the server in the order in which they are defined in the event sequence file.
Before you begin
About this task
All the events in an event sequence file (.eseq) must be defined by using the emit <event> construct or emit <event>, time-stamped <date & time> construct. The order in which the events are specified in the .eseq file determines the order in which they are processed. The event timestamp represents the time when an event occurs. For example, if there are three events in the .eseq file:
- event1 has a timestamp of 3/24/2015
- event2 has a timestamp of 3/25/2015
- event3 has a timestamp of 3/22/2015
The sequence of events that is processed is event1, event2, and then event3, regardless of their timestamps. event3 has a timestamp that is earlier than event2 and event1, and can be interpreted as an event that is delayed in transit, and arrived out of order. A test commences at the first timestamp of the event sequence, which must be an absolute time. Subsequent events can have timestamps that are earlier (in the past) or later (in the future) relative to the first timestamp. However, the order in which the events are processed is the order of the event sequence. In other words, all of the events are processed regardless of when they occurred.
Alternatively, if you want to create an event sequence with relative timestamps, you can use the time-stamped by the test scenario construct following the first event you emit. When you use this construct on the first event, all of the subsequent events are timestamped relative to the event immediately preceding them in the sequence. You can then reuse event sequences in a test scenario by emitting the same sequence with various timestamps.
Procedure
Examples
- Event attributes
-
Events can have event attributes, which can also have timestamps. In the following example, the request event attribute has a timestamp.
emit a new response event where the in response to is ( a new request event where the timestamp is 1/1/2015 ) , time-stamped 1/2/2015 ;In the following example, the address attribute of the new customer registration event is written inside the emit construct. The where construct is used in the a new <item> constructs.
emit a new customer registration where the address is ( a new address where the street is "221B Baker Street" , the city is "London" , the country is "UK" ) , time-stamped 3/25/2015 ; - Event sequence with a relative timestamp
- In the following example, a purchase event is emitted by the customer
Fred at a time specified in the test scenario. A
second and third purchase are emitted 3 days and
5 days after the first purchase event.
emit a new purchase where the customer is the customer "Fred", the amount is 100.0, time-stamped by the test scenario ; emit a new purchase where the customer is the customer "Fred", the amount is 50, time-stamped 3 days later ; emit a new purchase where the customer is the customer "Fred", the amount is 250, time-stamped 2 days later ; - Event sequence with separate concept definitions
- In the following example, the event sequence is composed of two
events, a customer registration event
and a purchase event,
which are related to two variables, the customer and purchase1. These variables are
defined in define statements,
outside of the emit statement.
The parentheses are optional.
define 'the customer' as the customer identified by "John"; emit ( a new customer registration where the customer is 'the customer' , the first name is "John" , the last name is "Watson" ) , time-stamped 3/25/2015 ; define 'purchase1' as a new purchase where the customer is 'the customer'; emit purchase1 , time-stamped 5 minutes later; - Event sequence with inline concept definitions
- In the following example, the event sequence is composed of two
events, a customer registration event
and a purchase event,
which are related to two variables, the customer and purchase1. The variable for the
address attribute of the
customer is defined inside of the emit definition for the
customer registration event.
The new customer
registration event does not contain the
values of the attributes of the address concept type that are
not identifiers, because the address instance is used
to establish the relationship. The parentheses are
optional.
define 'the customer' as the customer identified by "John"; emit a new customer registration where the customer is 'the customer' , the first name is "John" , the last name is "Watson" , the address is ( a new address where the address id is "123" the street is "221B Baker Street" , the city is "London" , the country is "UK" ) , time-stamped 3/25/2015 ; define 'purchase1' as a new purchase where the customer is 'the customer'; emit purchase1 , time-stamped 5 minutes later; - Event sequence where two events use the same variable
- In the following example, the variable paddington is reused in each event
to refer to a specific customer.
define 'paddington' as the customer identified by "paddington@example.com" emit a new customer registration where the customer is paddington , time-stamped 4/07/2015 ; emit a new purchase where the customer is paddington , the price is 25 , time-stamped 10 minutes later ; emit a new purchase where the customer is paddington , the price is 62 , time-stamped 3 days later ; - Event sequence with events that use different types of timestamps
- In the following example, the first purchase event has a timestamp
that is 10 minutes after the customer
registration event. The third event in
the sequence occurs 3 days after the previous event, which in this
example is the customer
registration event. These events show an
example of how to simulate a sequence of events that
are processed out of order.
define 'paddington' as the customer identified by "paddington@example.com" emit a new purchase where the customer is paddington , the price is 25 , time-stamped 4/07/2015 ; emit a new customer registration where the customer is paddington , time-stamped 10 minutes earlier ; emit a new purchase where the customer is paddington , the price is 62 , time-stamped 3 days later ;