none
Can you call .NET methods in the application domain with Coded UI?

    Question

  • We are evaluating whether to switch from using TestComplete to Coded UI, and one of the things that TestComplete allows you to do is to call .NET methods in the application under test. This helps us e.g. when we want to do things such as click a feature in a visual map, but it would be too hard to work out exactly which pixel to click (or to manipulate the map so the feature is visible). When things are too hard or fragile to do via the UI directly, we can expose a .NET method that the test can call.

    Can Coded UI do this, or do you have any other suggestions of a tool we could use to do this?

    Wednesday, June 29, 2016 12:46 AM

Answers

  • Hi Alice,

    Yes, Coded UI Test can simulated the click action on a particular part of the route. There are two ways can implement this requirement.

    The first one is using Coded UI Builder to record this action directly, which is more easily. But if the route line changed on screen, the playback will fail. For this situation, please use the cross-hair on Coded UI Builder to check the search properties for the route line and then using the search properties to find this route line and then click it.

    The second one is using hand-coding Coded UI, which need us write the action code by ourself. Please find the control (route line) using the search properties first and then using Mouse.Click() event to execute the click action for this control.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, July 04, 2016 3:03 AM
    Moderator

All replies

  • Hi johnsonalice,

    According to your description, you want to call the .NET method because the TestComplete is hard to work out exactly which pixel to click on the tested application UI, is it right?

    In Coded UI Test, if you want to execute a click on a control on the tested application UI, it will find that control based on the Search Properties of this control and then execute the click action. So Coded UI will find the control more easily. More explanation about Coded UI, please refer to following link which introduce how does Coded UI find a control.

    https://blogs.msdn.microsoft.com/balagans/2009/12/28/how-does-coded-ui-test-finds-a-control/

    And in Coded UI Test, we could using the CodedUI Test Builder to record the operations automatically and if there has any problem in the recorded Coded UI, we also can use hand code to create/modify the Coded UI code. Following link introduce how to create a hand coding Coded UI Test. Hope that can help you.

    https://blogs.msdn.microsoft.com/mathew_aniyan/2009/02/12/hand-coding-a-coded-ui-test/

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, June 30, 2016 5:20 AM
    Moderator
  • Our application has a map on which aircraft and the planned routes of the aircraft are displayed. The planned route is a line in 3D space. We would like to test manipulating the route using Coded UI. To do this the user needs to zoom/rotate the map until he can see the part of the route he wants to change, then he needs to click that point on the line.

    To make a test, we can:

    -work out what mouse actions the user would do, which would be very hard, then reproduce them

    -add a . NET method in the tested application method the testing application can call, which is what we have done for TestComplete. This method allows a click to be simulated on a particular part of the route. Is there anything similar we can do for Coded UI?

    Thanks,

    Alice

    Sunday, July 03, 2016 9:11 PM
  • Hi Alice,

    Yes, Coded UI Test can simulated the click action on a particular part of the route. There are two ways can implement this requirement.

    The first one is using Coded UI Builder to record this action directly, which is more easily. But if the route line changed on screen, the playback will fail. For this situation, please use the cross-hair on Coded UI Builder to check the search properties for the route line and then using the search properties to find this route line and then click it.

    The second one is using hand-coding Coded UI, which need us write the action code by ourself. Please find the control (route line) using the search properties first and then using Mouse.Click() event to execute the click action for this control.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, July 04, 2016 3:03 AM
    Moderator