Skip to content

Execution Time Measurement (v1.x)

Suremaker edited this page Feb 12, 2017 · 1 revision

Page version: 2.x / 1.x

During scenario execution, LightBDD framework captures execution start time and duration of each scenario and step.

Execution times are displayed on console during scenario execution:

SCENARIO: [Ticket-1] Successful login
  STEP 1/6: GIVEN the user is about to login...
  STEP 1/6: GIVEN the user is about to login (Passed after 9ms)
  STEP 2/6: AND the user entered valid login...
  STEP 2/6: AND the user entered valid login (Passed after <1ms)
  STEP 3/6: AND the user entered valid password...
  STEP 3/6: AND the user entered valid password (Passed after <1ms)
  STEP 4/6: WHEN the user clicks login button...
  STEP 4/6: WHEN the user clicks login button (Passed after 182ms)
  STEP 5/6: THEN the login operation should be successful...
  STEP 5/6: THEN the login operation should be successful (Passed after 5ms)
  STEP 6/6: AND a welcome message containing user name should be returned...
  STEP 6/6: AND a welcome message containing user name should be returned (Passed after 14ms)
  SCENARIO RESULT: Passed after 233ms

Execution start and execution time (duration) are also available in feature summary reports:

<?xml version="1.0" encoding="utf-8"?>
<TestResults>
  <Summary TestExecutionStart="2015-06-21T16:41:30.0407422Z" TestExecutionTime="PT0.1548422S">
    <Features Count="6" />
    <Scenarios Count="11" Passed="7" Bypassed="1" Failed="1" Ignored="2" />
    <Steps Count="55" Passed="48" Bypassed="1" Failed="1" Ignored="2" NotRun="3" />
  </Summary>
  <Feature Name="Basket feature" Label="Story-4">
    <Description>In order to buy products
As a customer
I want to add products to basket</Description>
    <Scenario Status="Passed" Name="No product in stock" Label="Ticket-6" ExecutionStart="2015-06-21T16:41:30.0407422Z" ExecutionTime="PT0.0400985S">
      <Category Name="Sales" />
      <Step Status="Passed" Number="1" Name="GIVEN product is out of stock" ExecutionStart="2015-06-21T16:41:30.0477469Z" ExecutionTime="PT0.0001926S">
        <StepName StepType="GIVEN" Format="product is out of stock" />
      </Step>
      <Step Status="Passed" Number="2" Name="WHEN customer adds it to the basket" ExecutionStart="2015-06-21T16:41:30.0657594Z" ExecutionTime="PT0.0029931S">
        <StepName StepType="WHEN" Format="customer adds it to the basket" />
        <Comment>Transferring 'product' to the basket</Comment>
      </Step>
      <Step Status="Passed" Number="3" Name="THEN the product addition should be unsuccessful" ExecutionStart="2015-06-21T16:41:30.0707627Z" ExecutionTime="PT0.0074772S">
        <StepName StepType="THEN" Format="the product addition should be unsuccessful" />
      </Step>
      <Step Status="Passed" Number="4" Name="AND the basket should not contain the product" ExecutionStart="2015-06-21T16:41:30.0787681Z" ExecutionTime="PT0.0014522S">
        <StepName StepType="AND" Format="the basket should not contain the product" />
      </Step>
    </Scenario>
    <!- ... ->
  </Feature>
  <!- ... ->
</TestResults>

The XML report is most precise, while times in HTML/Plain Text reports are shortened to most significant order of magnitude to make it easier to read.

Please note that sum of step execution times is usually smaller than scenario execution time. It is because step execution time covers only step method execution, while scenario execution time includes framework overhead to run each step (preparation, parameterized steps argument evaluation, step result collection, etc.).

Continue reading: Feature Fixture

Clone this wiki locally