Coded Steps

Test Studio Mobile supports coded steps. This allows you to write code and have it executed as a test step. Use a coded step for a scenario that requires more complexity than what can be composed with the Step Builder.

  1. Add a Coded Step from the Step Builder.

    Add Coded step

  2. Select coding language.

    Select coding language

    This creates a code-behind file with an empty test method where you can implement your custom code.

  3. In order to execute the code in the test method you should bind it to an existing coded step in the test to which this test class belongs.Double click the coded step in your test in order to access the drop down menu with all valid methods. Select one and save the test.

    valid methods are methods of a Public Partial Class that inherits IOSTestBase, AndroidTestBase or WebTestBase depending on the test type you are using.

    Bind a coded step

  4. Here is an example how to use a simple "Tap" command and how to access the recorded elements that belong to the particular test.

    All recorded elements are stored in Elements collection.

    this.ActiveDevice.IOS.Tap(this.Elements.MyScreen1.UIRoundedRectButton);
    
    Me.ActiveDevice.IOS.Tap(Me.Elements.MyScreen1.UIRoundedRectButton)
    

See Also