Checkpoint Function

Action

To monitor the progress and success of a single user during a load test in a more precise manner than viewing the full output of the virtual user, checkpoints are used to divide transactions into user-defined sections. Checkpoint messages are visible in the output window during Try Scripts, and during load tests when the output of a single virtual user is enabled. The output of checkpoint messages can be enabled and disabled via the Checkpoint button on the monitor toolbar.

You can specify a message that the checkpoint displays in the output window. Additionally, you can set a timer for a checkpoint, which measures the time between the preceding checkpoint and the call of the checkpoint function. The first checkpoint in a transaction measures the time between the beginning of the transaction and the call of the checkpoint function. If an error, warning, or success message occurs between the preceding checkpoint and the call of the checkpoint function, the checkpoint message icon highlights the highest severity of all messages raised during the interval (error > warning > success).
Important: Checkpoint names must be unique across load tests.

Include file

kernel.bdh

Syntax

    Checkpoint(
      sCheckpointName : in string,
      sMessage : in string optional,
      bUseTimer : in boolean optional) : boolean;
  
Parameter Description
sCheckpointName The name of the checkpoint. Must be unique across the entire load test.
sMessage An additional message that is displayed in the output window and the log file.
bUseTimer If true, a timer with the checkpoint's name is created. The timer measures the time between the preceding checkpoint and the call of the checkpoint function. The first checkpoint in a transaction measures the time between the beginning of the transaction and the call of the checkpoint function.

Return value

  • true if successful
  • false otherwise

Example

benchmark BenchmarkName
 
use "kernel.bdh"
use "webapi.bdh"
 
dcluser
  user
    VirtUser
  transactions
    TMain       : 1;
                              
dcltrans
  
  transaction TMain
  begin
    Checkpoint("checkpoint1s", "Hello World!", true);
    
    PrintData("hello", "the data");
    PrintFunction("func", "info");
    
    RaiseError(CUSTOM_ERROR, "This is a warning!", SEVERITY_WARNING);
    ThinkTime(2.0);
    
    MeasureStart("commonMeasure");
    Wait(0.5);
    MeasureStop("commonMeasure");
    
    Checkpoint("checkpoint2w", "2", true);
    
    ThinkTime(3.0);
    
    RaiseError(CUSTOM_ERROR, "This is an error!", SEVERITY_ERROR);
    
    Checkpoint("checkpoint3e", "this line should be displayed in red", true);
    
    ThinkTime(0.5);
    
    Checkpoint("checkpoint4s", "");

  end TMain;