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
-
Right click on the project in the Project Explorer or on a folder in the project and click Add Code Item.
-
Choose the coding language.
-
Choose a name and and click OK (HelperClass in our example).
-
The Code Item with HelperClass name is created under the selected location.
How To Use Code Item
This is an example how to use the code item.
Open the already created coded item (HelperClass).
-
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} ```
-
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.