Time Tracking
Description
In dealing with automation, often one finds the necessity to have performance testing or analysis charts for tests. The ability to articulate such idea gives our automation more flexibility. This is main purpose of Time Tracking. This will help Nexial user to analyse the time results for test steps and also for different execution levels.
Nexial will generate new log file nexial-timetrack.log
in logs
folder of output directory under target project.
It will have logs for the tracked steps and tracked execution levels.
Remark is simply a tracking status. Following are the remarks for some scenarios
- If execution is ended due to
EndIf
condition without ending tracking, remark will be “Execution interrupted”. - If execution is failed in the middle without ending tracking, remark will be “Execution failed”.
- If execution is completed without ending tracking, remark will be “Execution ended.”
- If tracking ended with
TimeTrackEnd
, remark will be empty.
Time tracking should be specified in flow controls column so as they are treated just like flow control.
The syntax of Time Tracking is same as that of flow control. The general syntax looks like:
TimeTrackStart(label)
TimeTrackEnd()
TimeTrackStart(label)
TimeTrackStart
will be start point for time tracking for steps. Label is simply the description, or label, for an
instance of time tracking. Label is OPTIONAL. Default label is script-name#scenario-name
. During execution, Nexial
will evaluate this before test step execution. So start time will be the start time of that step.
TimeTrackEnd()
TimeTrackEnd
will be end point for time tracking. During execution, Nexial will evaluate this after test step
execution. So end time will be the end time of that step.
Lets have a look how to add TimeTrackStart
and TimeTrackEnd
in scripts.
Example
Script:
Log File:
In above images, you can see that first two lines are without remark while third line is with remark as tracking is not ended in the script.
Notes
- Nexial does not support nested tracking till this point. For example, you have
TimeTrackStart
for the first step, again in third steps you haveTimeTrackStart
. You have not closed firstTimeTrackStart
withTimeTrackEnd
. This is nested tracking. Currently Nexial does not support this feature at this time. - If you have
TimeTrackStart
in successive steps without havingTimeTrackEnd
, Nexial will take first one into consideration for tracking purpose. Two successiveTimeTrackEnd
will do the same. - If you have a
TimeTrackStart
in your script without a correspondingTimeTrackEnd()
, Nexial will automatically end that tracking at iteration level.
Event Tracking
Nexial also supports time tracking for different execution events via System variables.
nexial.timetrack.trackExecution
- This is event for tracking logs with start, end and elapsed time of the execution. Default value isfalse
.nexial.timetrack.trackScript
- This is event for tracking logs with start, end and elapsed time of each script. Default value isfalse
.nexial.timetrack.trackIteration
- This is event for tracking logs with start, end and elapsed time of each iteration. Default value isfalse
.nexial.timetrack.trackScenario
- This is event for tracking logs with start, end and elapsed time of each scenario. Default value isfalse
.
To activate time tracking for any of these events, simply define the corresponding System variables as true
:
Log file format
The time tracking information is logged to logs/nexial-timetrack.log
under the
output directory. By default, the log information
follows the following format:
START_DATE|START_TIME|END_DATE|END_TIME|ELAPSED_TIME|THREAD_NAME|LABEL|REMARK
It is possible to customize this log format via the
nexial.timetrack.format
System variable. One may customize what
information to log and the order thereof. For example,