Forum Discussion

veronica_glynn's avatar
veronica_glynn
Contributor
11 years ago

Increment of integer variable not working

My goal is to create a variable that will increment by 1 with each test run. I need the final result to be passed into a text field reading: 'AutomationSet_100' with the integer increasing in value ea...
  • ArtemS's avatar
    11 years ago
    Hello,

    Keyword test variables do not store values between test runs. They reset their value to defaul value upon each new run.

    To store values between test runs, use persistent project variables or persistent project suite variables. See Project And Project Suite Variables - Overview

    Thus the actions should be:

    1. Add a project variable in the Persistent Variables section of the Variables page of Project Editor.

    Name: TestRunsCounter; Type: Integer; Default Value: 100

    2. In Keyword Test insert a Set Variable Value operation.

    Mode:  Code Expression; Value: Project.Variables.TestRunsCounter+1

    3. In Keyword Test, pass that variable to your control's text field:

    aTextField.SetText(IntToStr(Project.Variables.TestRunsCounter))