Coded UI Testing in Windows Forms Controls
11 Oct 20222 minutes to read
This section demonstrates how to create a simple test with TreeViewAdv. The Coded UI functionality can be tested from VS2010 or above with Ultimate or Premium version. TreeViewAdv supports Coded UI from Syncfusion Essential Studio version v9.1.0.20.
Creating Coded UI Project
CUIT should contain the Coded UI test project. When the Application does not contain the CUIT project, create a new project.
NOTE
The CUIT file is generated automatically, when creating the Coded UI test project. To add another test file, choose shortcut menu of the CUIT project, point to add, and then choose Coded UI test
Recording Steps
While generating code for Coded UI Test dialog box, choose the Record actions as shown in the following image.
-
After choosing the option, Coded UI Test Builder UIMap is shown at the BottomRight of the window.
-
Choose the Start recording option from the UI Map to record the testing and it is also possible to pause the recording while testing the application.
-
The recorded steps can be viewed by using the UIMap or by pressing “Alt + S” key.
-
To delete actions that was recorded by mistake, choose “Edit” Actions.
-
To generate code that replicates performed actions, choose the Generate Code icon and type a name and description for CUIT method.
- After completion of the testing process, choose the Generate code option from the UI Map to generate the code in the test project. The generated code replicates performed actions.
- Choose the required method and description for code generation.
Testing Recorded Steps
The Application can be tested with the generated CUIT Method.
-
Add a TestMethod named
CodedUITestMethod1
.public void CodedUITestMethod1() { // Generates code for this test. Select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items. this.UIMap.RecordedMethod1(); }
Public Sub CodedUITestMethod1() ' Generates code for this test. Select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items. Me.UIMap.RecordedMethod1() End Sub
-
Build and Run the application that has already been configured.
-
Right click the body of the CodedUITestMethod and then select Generate Code for Coded UI Test -> Use CUIT builder as shown in the following screenshots.
- Now CUIT performs Recorded testing process.
Supported Controls
The following controls are featured with Coded UI Testing support.
Supported controls | Levels |
---|---|
GridControl | 4 Levels |
GridGroupingControl | 4 Levels |
GridDataBoundGrid | 4 Levels |
TreeViewAdv | 2 Levels |
RibbonControlAdv | 2 Levels |
Carousel | 2 Levels |
RadialMenu | 2 Levels |
TabControlAdv | 2 Levels |
TabSplitterContainer | 2 Levels |