locked
CodedUI SearchProperties.Add UITestControl.PropertyNames.Name Not Equal to RRS feed

  • Question

  • I am writing an automated test to drive Visual Studio IDE for an extension.

    I've found that I can run my codedui tests from the vstest.console commandline just fine, however if I try to debug my automated tests from a Visual Studio instance, codedui gets confused and ends of interacting with the wrong visual studio instance. 

    I have the following property set:

            public UIObjectsVSMainWindow()
            {
                SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.Name, "Microsoft Visual Studio", PropertyExpressionOperator.Contains));
            }


    I want to add a search property where the name of the control is NOT equal to say "Debugging". 

    Along the lines of:

            public UIObjectsVSMainWindow()
            {
                SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.Name, "Microsoft Visual Studio (Running)", PropertyExpressionOperator.NotEqual));
            }

    However I can't seem to find a 'NotEqual' method to use, like:

    PropertyExpressionOperator.NotEqual

    How can I add a search property for the name of a window and have it NOT be equal to some value. 

    Here is the sample project: Sample Project and Solution

    Debug the test from Visual Studio and you will see that the debugging instance of Visual Studio starts to get interacted with instead of the Visual Studio instance under test.


    Ian Ceicys


    • Edited by Ian Ceicys Thursday, July 16, 2015 7:10 PM
    Thursday, July 16, 2015 7:10 PM

Answers

  • Hi lan,

    Thank you for posting in MSDN forum.

    As far as I know that the PropertyExpressionOperator has only Contains and EqualTo options there in coded UI test like the following screen shot.

    So it is default that the PropertyExpressionOperator is not the 'NotEqual' method in coded UI test.

    However, if you still want to feature request, I suggest you could submit this feature request:

    http://visualstudio.uservoice.com/forums/121579-visual-studio, the Visual Studio product team is listening to user voice there. You can send your ideas/suggestions there and people can vote.

    In addition, I suggest you could try to use this EqualTo method to verify the name property correct or not correct.

    Thanks for your understanding!

    Best Regards,


    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.


    • Edited by Tina-Shi Friday, July 17, 2015 9:43 AM
    • Proposed as answer by Tina-Shi Thursday, July 23, 2015 12:18 PM
    • Marked as answer by Tina-Shi Friday, July 24, 2015 2:27 AM
    Friday, July 17, 2015 9:43 AM
  • Hi lan,

    Sorry for my delay.

    >>In the mean time, how can I handle the application window title changing dynamically throughout the test.

    Generally, I know that we could use this the Contains member of PropertyExpressionOperator Enumeration to handle the dynamic window title name like you provided code.

    http://blogs.msdn.com/b/mathew_aniyan/archive/2011/03/01/smart-match-amp-slow-coded-ui-tests.aspx

    And then you could try to enable the smartmatch option for playback will also help finding the application with similar changing title. You can enable the smart match by using following code : 

    Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.TopLevelWindow;

    Hope it help you!

    Best Regards,

    In addition, I research about how to handle

    https://social.msdn.microsoft.com/Forums/en-US/6b60a8e5-6276-4a09-b37d-a065af9a5851/window-title-changes-dynamically-with-each-test-execution-how-to-get-tests-to-extractuse-new?forum=vsautotest


    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.

    • Proposed as answer by Tina-Shi Thursday, July 23, 2015 12:18 PM
    • Marked as answer by Tina-Shi Friday, July 24, 2015 2:27 AM
    Tuesday, July 21, 2015 8:45 AM

All replies

  • Hi lan,

    Thank you for posting in MSDN forum.

    As far as I know that the PropertyExpressionOperator has only Contains and EqualTo options there in coded UI test like the following screen shot.

    So it is default that the PropertyExpressionOperator is not the 'NotEqual' method in coded UI test.

    However, if you still want to feature request, I suggest you could submit this feature request:

    http://visualstudio.uservoice.com/forums/121579-visual-studio, the Visual Studio product team is listening to user voice there. You can send your ideas/suggestions there and people can vote.

    In addition, I suggest you could try to use this EqualTo method to verify the name property correct or not correct.

    Thanks for your understanding!

    Best Regards,


    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.


    • Edited by Tina-Shi Friday, July 17, 2015 9:43 AM
    • Proposed as answer by Tina-Shi Thursday, July 23, 2015 12:18 PM
    • Marked as answer by Tina-Shi Friday, July 24, 2015 2:27 AM
    Friday, July 17, 2015 9:43 AM
  • Tina-Shi, thank you I will add the request to user voice. In the mean time, how can I handle the application window title changing dynamically throughout the test (hence why I was using contains)?

    Ian Ceicys

    Friday, July 17, 2015 1:52 PM
  • Hi lan,

    Sorry for my delay.

    >>In the mean time, how can I handle the application window title changing dynamically throughout the test.

    Generally, I know that we could use this the Contains member of PropertyExpressionOperator Enumeration to handle the dynamic window title name like you provided code.

    http://blogs.msdn.com/b/mathew_aniyan/archive/2011/03/01/smart-match-amp-slow-coded-ui-tests.aspx

    And then you could try to enable the smartmatch option for playback will also help finding the application with similar changing title. You can enable the smart match by using following code : 

    Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.TopLevelWindow;

    Hope it help you!

    Best Regards,

    In addition, I research about how to handle

    https://social.msdn.microsoft.com/Forums/en-US/6b60a8e5-6276-4a09-b37d-a065af9a5851/window-title-changes-dynamically-with-each-test-execution-how-to-get-tests-to-extractuse-new?forum=vsautotest


    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.

    • Proposed as answer by Tina-Shi Thursday, July 23, 2015 12:18 PM
    • Marked as answer by Tina-Shi Friday, July 24, 2015 2:27 AM
    Tuesday, July 21, 2015 8:45 AM