Forum Discussion

TestQA1's avatar
TestQA1
Frequent Contributor
3 years ago

Adding counter that increments automatically in BDD scripts

Hi all, My bdd test structure is as below:   Scenario Given ... When .. Then ...   Scenario Given ... When .. Then ...    and so on...   In every 'Then' in the Gherkin above, I have an...
  • mikef's avatar
    3 years ago

    Hi TestQA1 

     

    Could you create a Project Variable, then write a basic increment method to increment and log the count each time it is called in the Then step?

     

    For example : 

    function counter(){   
      Project.Variables.TestCount= Project.Variables.TestCount++
      Log.Message("TestCase " + Project.Variables.TestCount+" has completed")    
    }