Page 1 of 1

Using sStepName

Posted: Wed Mar 22, 2017 8:25 pm
by PeteMahoney
The Step class contains an attribute sStepName which can be used to obtain the name of the current step. This attribute can then be used to identify from which step a specific output line occurs in the results of a test run. This annotated output can be helpful in quickly determining from where specific Print, LogData, LogError, and Exceptions occurred without leaving the Results tab. While errors can be traced back to the originating line of code in the Results tab, it does not indicate from which instance of step (if there is more than one of the same step) in test.

Code: Select all

class ItemEntry : Step
  Main()
     Print ("{this.sStepName} step : Begins")
     
     Print ("{this.sStepName} step : Item being entered")
     
     LogData (ItemData, "{this.sStepName} step : Items being entered")
     
     LogError ("{this.sStepName} step : An error occurred entering Item")
     
     throw Exception ("{this.sStepName} step : An exception thrown entering Item")
          
     Print ("{this.sStepName} step : Ends")
Note:
This attribute is not documented in Step class section of the AscentialTest help file and may not be a supported feature or available in future releases. However, when editing in the Source Editor, typing "Step." will show "sStepName" as autocomplete option which is how this attribute was discovered.