none
Drag and Drop in Coded UI RRS feed

  • Question

  • I'm using VS 2010. Could anyone help me out in getting faster execution for the following tasks in Coded UI.

    1. Dragging and dropping a device from one pane to the other. (Recording works fine, but takes too long time for drag and drop operation)

    2. While running the tests, it is taking long time between the actions. How could I reduce the delay between two different actions in Coded UI ?

    Best Regards.

    Friday, August 23, 2013 2:51 AM

Answers

  • Hello,

    Thank you for your post.

    Just to make the issue clearly, whether it takes too long time for drag and drop operation both when you record this action and run the test?
    If yes, please try to drag and drop the device on your machine manually without recording actions using Coded UI test, whether it also will take a long time? If yes, I am afraid that the issue is more related to your application or machine environment rather than Coded UI test. In order to check if the slow drag and drop operation is related to test environment, I suggest that you try it on another machine to check the result.

    In addition, if the drag and drop operation during recording is slow, it is reasonable that this action is played back slowly since Coded UI Test play backs what it records.

    If the speed of the recording of drag and drop action is fine but it will take long time to play back, I suggest that you try to see the coded UI test error stack trace information after test run and check if there are some useful and related information.

    In order to improve the speed of drag and drop action playback, you can try the following settings in your coded UI test:

    Playback.PlaybackSettings.WaitForReadyTimeout = 0;

    Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.Disabled;

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Punitha Reddy Tuesday, August 27, 2013 6:37 AM
    Friday, August 23, 2013 8:53 AM
    Moderator
  • Hello,

    As I mentioned above, if the speed of the recording of drag and drop action is fine but it will take long time to play back, I suggest that you try to see the coded UI test error stack trace information after test run and check if there are some useful and related information. And you can post error stack trace information here so that we can further look at this issue.

    Issue takes place especially, when action is recorded in one machine and trying to run the same action in different machine.

    As far as I know, if the value of some properties of some controls will changed on another machine, it wil impact the speed of the playback. For more information, please see: Smart Match & Slow Coded UI Tests

    Please check if there are such controls on your application. If yes, you can try the solution in the blog above to resolve it.

    If possible, you can post the code of CheckTest() and this.uimap.GotoBus() methods so that we can see if there are some relationships between two methods.

    Also you can refer to this blog: Configuring Playback in Visual Studio 2010 to improve the performance of playback.

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Punitha Reddy Tuesday, August 27, 2013 9:34 AM
    Monday, August 26, 2013 2:15 AM
    Moderator
  • Hello,

    Glad to receive your reply.

    For question 1, it is searching the exact control based on the searchproperties. By default the search timeout time that the Coded UI engine attempt to locate a control is 2 mins. You can try to use SearchTimeout property of PlaybackSettings Class to modify the timeout. But if you make the search time not to exceed 500ms, maybe the test will fail because many controls are not found.

    Based on the log information, I noticed that the long delay is actually because the windows with name: 'C:\\Users\\111\\Documents\\Auto\\Project43\\Project43' can’t be found. I think that resolving this issue will improve the performance of test. How to resolving this issue is also your question 2.

    You can refer to this blog:

    Smart Match & Slow Coded UI Tests

    There are detailed explanation and solutions for that warning message.

    You can modify the Window search to handle the dynamic name. You do this by adding a UIMap constructor in the file UIMap.cs and override the Window name search.

    e.g:-

    public UIMap()
    {
        this.UIApplicationv1013Window.SearchProperties.Add(WinWindow.PropertyNames.Name, "Application v", PropertyExpressionOperator.Contains);
    }

    In your case, you can do like this:

        this.UIApplicationv1013Window.SearchProperties.Add(WinWindow.PropertyNames.Name, " Documents\Auto\Project", PropertyExpressionOperator.Contains);

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Punitha Reddy Tuesday, August 27, 2013 8:12 AM
    Tuesday, August 27, 2013 7:11 AM
    Moderator

All replies

  • Hello,

    Thank you for your post.

    Just to make the issue clearly, whether it takes too long time for drag and drop operation both when you record this action and run the test?
    If yes, please try to drag and drop the device on your machine manually without recording actions using Coded UI test, whether it also will take a long time? If yes, I am afraid that the issue is more related to your application or machine environment rather than Coded UI test. In order to check if the slow drag and drop operation is related to test environment, I suggest that you try it on another machine to check the result.

    In addition, if the drag and drop operation during recording is slow, it is reasonable that this action is played back slowly since Coded UI Test play backs what it records.

    If the speed of the recording of drag and drop action is fine but it will take long time to play back, I suggest that you try to see the coded UI test error stack trace information after test run and check if there are some useful and related information.

    In order to improve the speed of drag and drop action playback, you can try the following settings in your coded UI test:

    Playback.PlaybackSettings.WaitForReadyTimeout = 0;

    Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.Disabled;

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Punitha Reddy Tuesday, August 27, 2013 6:37 AM
    Friday, August 23, 2013 8:53 AM
    Moderator
  • Hello,

    As I mentioned above, if the speed of the recording of drag and drop action is fine but it will take long time to play back, I suggest that you try to see the coded UI test error stack trace information after test run and check if there are some useful and related information. And you can post error stack trace information here so that we can further look at this issue.

    Issue takes place especially, when action is recorded in one machine and trying to run the same action in different machine.

    As far as I know, if the value of some properties of some controls will changed on another machine, it wil impact the speed of the playback. For more information, please see: Smart Match & Slow Coded UI Tests

    Please check if there are such controls on your application. If yes, you can try the solution in the blog above to resolve it.

    If possible, you can post the code of CheckTest() and this.uimap.GotoBus() methods so that we can see if there are some relationships between two methods.

    Also you can refer to this blog: Configuring Playback in Visual Studio 2010 to improve the performance of playback.

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Punitha Reddy Tuesday, August 27, 2013 9:34 AM
    Monday, August 26, 2013 2:15 AM
    Moderator
  • Hello,

    Glad to receive your reply.

    For question 1, it is searching the exact control based on the searchproperties. By default the search timeout time that the Coded UI engine attempt to locate a control is 2 mins. You can try to use SearchTimeout property of PlaybackSettings Class to modify the timeout. But if you make the search time not to exceed 500ms, maybe the test will fail because many controls are not found.

    Based on the log information, I noticed that the long delay is actually because the windows with name: 'C:\\Users\\111\\Documents\\Auto\\Project43\\Project43' can’t be found. I think that resolving this issue will improve the performance of test. How to resolving this issue is also your question 2.

    You can refer to this blog:

    Smart Match & Slow Coded UI Tests

    There are detailed explanation and solutions for that warning message.

    You can modify the Window search to handle the dynamic name. You do this by adding a UIMap constructor in the file UIMap.cs and override the Window name search.

    e.g:-

    public UIMap()
    {
        this.UIApplicationv1013Window.SearchProperties.Add(WinWindow.PropertyNames.Name, "Application v", PropertyExpressionOperator.Contains);
    }

    In your case, you can do like this:

        this.UIApplicationv1013Window.SearchProperties.Add(WinWindow.PropertyNames.Name, " Documents\Auto\Project", PropertyExpressionOperator.Contains);

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Punitha Reddy Tuesday, August 27, 2013 8:12 AM
    Tuesday, August 27, 2013 7:11 AM
    Moderator
  • Hello Punitha,

    How do see the delay time between two different test methods in an ordered test?

    If possible, please provide us related information so that we can further look at this issue.

    Thanks,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, August 27, 2013 10:23 AM
    Moderator
  • Hello,

    Glad to receive your reply.

    I don’t think that Smart Match can reduce the delay between two test methods in an ordered test. A Smart Match algorithm is used to identify controls if they cannot be located using the exact properties by record and playback engine. It just can improve the performance of one coded UI test run.

    I've used a timer to check the delay between particular actions.

    Do you mean that you use a timer to check delay between actions in one test method? In this case, I don’t think it can check the delay time between two test methods in one ordered test. If you use a timer between two test methods in one ordered test, please post two test methods including the timer in details so that we can further look at this issue.

    As far as I know, there is no way to set the delay between two test methods in an ordered test. I think that in order to reduce the delay, we need to understand the root reason of this delay.

    I suggest that you try to collect test log information based on this blog: How to Enable VSTS Logging? to check if there are any useful information.

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, August 28, 2013 12:21 PM
    Moderator