One of the most powerful feature of Herogi is customizing actions and validations. This customization is not limited with static data, you can also use dynamic data which available in session context. This way you can create full custom actions for each session in the scenario.
Each incoming event bundled with default informations and also additional event parameters. All these data are available in scenario context.
Data listed below is always available for each event;
Key | Data Type | Sample Value | Description |
---|---|---|---|
_sessionId | STRING | userId123 | Current session identifier of incoming event |
_eventName | STRING | loginEvent | Name of incoming event |
_scenarioName | STRING | BlackFriday | Active scenario name |
_timestamp | NUMERIC | 1490709926 | Timestamp of incoming event |
Getting and using event data is easy;
${event._sessionId.value()}
and this will be replaced as;
userId123
You can also mix static data and dynamic data together, for example;
Hello ${event._sessionId.value()},
You entered the ${event._scenario.value()} at ${event._timestamp.value()?number_to_datetime?string("YYYY-MM-dd HH:mm:ss")} with event ${event._eventName.value()}
and this should be replaced as;
Hello userId123,
You entered the BlackFriday at 2017-03-28 21:10:00 with event loginEvent
In addition to default event parameters, you can use event parameters bundled with event and sent by api or clients in same way.
If registerEvent
has three parameters like fullname
,birthday
,email
, you can get these parameters in any scenario context;
${event.fullname.value()}, ${event.birthday.value()}, ${event.email.value()}
If the parameters have values John
, 01-Jan-1983
, john@example
, result will be;
John, 01-Jan-1983, john@example
If you enable aggregation on any of event parameters, aggregation functions and data will be available in the scenario context.
Available aggregation functions are;
Function | Data Type | Sample Value | Description |
---|---|---|---|
min | NUMERIC | 10 | Miminum value |
max | NUMERIC | 1300 | Maximum value |
avg | NUMERIC | 465 | Average value |
count | NUMERIC | 8 | Total number of occurence |
If addToCart
event has an aggregated parameter called amount
, you can use aggregation functions in any scenario context;
${event.amount.min()}, ${event.amount.max()}, ${event.amount.avg()}, ${event.amount.count()}
If the parameter have three history values like 10
, 12
, 5
, result will be;
5, 12, 9, 3
Tip: Actual aggregation results can be different depends on aggregation type
Session data is pretty much similar to event data. Once you define session in the scenario, you can have session data in the scenario context.
Tip: Data should be added in to specific session by KeyValueStoreAction
Getting and using session data is easy, if you have session defined as username
in the scenario, you can get it;
${session.username.value()}
and this will be replaced as;
john