Stop time
Time measurement during a test can be very helpful. The
Read the next example and you will understand the mix of different time lines:
XML DSL
<testcase name="StopTimeTest">
<actions>
<trace-time/>
<trace-time id="time_line_id"/>
<sleep seconds="3.5"/>
<trace-time id=" time_line_id "/>
<sleep milliseconds="5000"/>
<trace-time/>
<trace-time id=" time_line_id "/>
</actions>
</testcase>
Java DSL designer and runner
@CitrusTest
public void stopTimeTest() {
stopTime();
stopTime("time_line_id");
sleep(3.5); // do something
stopTime("time_line_id");
sleep(5000); // do something
stopTime();
stopTime("time_line_id");
}
The test output looks like follows:
Starting TimeWatcher:
Starting TimeWatcher: time_line_id
TimeWatcher time_line_id after 3500 milliseconds
TimeWatcher after 8500 seconds
TimeWatcher time_line_id after 8500 milliseconds
Note
In case no time line id is specified the framework will measure the time for a default time line.To print out the current elapsed time for a time line you simply have to place the