)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to perform the CodedUI testing in WinForms TreeViewAdv?

Platform: WinForms |
Control: TreeViewAdv |
Published Date: September 4, 2015 |
Last Revised Date: February 4, 2020

CodedUI testing

You can perform the Coded UI Test (CUIT) in the TreeViewAdv can be used for testing purposes.

TreeViewAdv:

The Essential Tools TreeViewAdv control has basic level of Coded UI automation testing support. 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. Refer to the following steps to provide Coded UI support in the TreeViewAdv.

Create a Coded UI test project:

CUIT should contain the coded UI test project. If your application does not contain the CUIT project, create a new project. In the Solution Explorer, on the shortcut menu of the solution, choose Add, New Project, and then select either Visual Basic or Visual C#. Next, choose Test, Coded UI Test.

In case, the Coded UI test project does not appear on Visual Studio, you may be using the version that does not support CUIT. To create CUIT, you need to use Visual Studio Enterprise edition.

Creating test application

Figure 1: Creating Test Application.

Adding Coded UI test file:

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.

Adding CodedUITest file to the test project

Figure 2: Adding “Coded UI Test” file to the test project

  1. In the Generate Code for Coded UI Test dialog box, choose the Record actions as shown in the following image.

 

Recording option to generate code for CodedUITest

Figure 3: Recording option to generate code for Coded UI Test

  1. After choosing the option Coded UI Test Builder (UIMap) is shown at the BottomRight of the window.
  2. Choose start recording option from the UI Map to record the testing. You can also pause the recording while testing the application.

 

Start recording from UIMap

Figure 4: Start recording from UIMap

 

Pause recording from UIMap

Figure 5: Pause recording from UIMap

  1. The recorded steps are shown by using the UIMap or by pressing Alt + S key.
  2. To delete actions that you had recorded by mistake, choose Edit Actions.
  3. To generate code that replicates your action, choose the Generate Code icon and type a name and description for your CUIT method.

Record steps shown in UIMap

Figure 6: Recorded steps shown in UIMap

  1. 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 your actions.

Generate code in UIMap

Figure 7: Generate code in UI Map

  1. Choose the required method and description for code generation.

Generate code window for UIMap

Figure 8: Generate code window for UI Map

Testing application with the Generated Coded UI Tests:

You can test the application with the generated CUIT method.

1. Add a TestMethod called CodedUITestMethod1.

C#

[TestMethod]
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();
}

VB

<TestMethod> _
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

2. Build and run the application that has already been configured. You can also open the CUIT builder with the following steps.

3. Right click the body of the CodedUITestMethod and then select Generate Code for Coded UI Test -> Use CUIT builder as shown in the following screenshot:

Opening Coded UI Test builder

Figure 9: Opening Coded UI Test Builder

show Coded UI Map

Figure 10: Coded UI Map

Assert window for TreeViewAdv in Coded UI Test Builder

Figure 11: Assert window for TreeViewAdv in Coded UI Test Builder

Samples:

C#: TreeViewAdv-CodedUISupport_C#

VB: TreeViewAdv-CodedUISupport_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon