Code Item

Add a code item to create a utility class that defines a set of methods which perform common, often re-used functions. The code item can be used also as a helper class which can assist in providing some extended functionality for your test project.

How To Create Code Item

  1. Right click on the project in the Project Explorer or on a folder in the project and click Add Code Item.

    Add Code Item

  2. Choose the coding language.

    Choose coding language

  3. Choose a name and and click OK (HelperClass in our example).

    Name of the coded item

  4. The Code Item with HelperClass name is created under the selected location.

    Created code item

How To Use Code Item

This is an example how to use the code item.

  1. Open the already created coded item (HelperClass).

  2. Create a simple Query which locates an element with class UIStepper and Index 1.

        public static IOSQuery UIStepperControl = new IOSQuery() { Class = "UIStepper", Index = 1};
        Public Shared UIStepperControl As New IOSQuery() With {.Class = "UIStepper", .Index  = True}

    Create a query

  3. In order to access the functions and methods from the Code Item in the test code-behind file you should add an using statement which matches the namespace of the HelperClass.

    Using statement

See Also

In this article
Not finding the help you need? Improve this article