locked
Handling multiple instances of same application in CUIT RRS feed

  • Question

  • Hi All,

    I came across scenario in our project where, I need to open my Application Under Test and get write access to one of our internal resource. In this state, I need to launch another instance of my Application Under Test and try to get write access for the same internal resource. Expected result is an alert to the end user. I need to validate it in second instance of AUT.

    Here are my Qs:

    1. CUIT supports multiple AUTs? 

    2. How to set focus to specific AUT in the above scenario?

    3. Is there any other approach for this problem, in case multiple AUTs are not possible?

    Friday, February 23, 2018 12:12 PM

Answers

  • Hi Subbu,

    >> When I try to execute, though it is launching second instance of the AUT, remaining steps it is trying to do on first instance instead of second instance of AUT.

    Please use properties to recognition the second instance by hand-coding. Add “Control.DrawHight();” event in your code to highlight the second instance before remaining steps, check the result.

    What is the content of the remaining steps?

    I suggest you could specify the instance name as a parameter, please refer to following snippet code:

    WpfEdit edit=new WpfEdit(second instance’s name); //find the edit control on second instance

    Hope could help you.

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 9, 2018 7:37 AM

All replies

  • Hi Subbu,

    Welcome to the MSDN forum.

    Could you share us more information about the "internal resource"?

    Based on my test with WPF application, we could open multiple WPF instance in coded UI test. And, identify the controls of the opened WPF application.

    After I specify the instance name as a parameter, CUIT accurately identifies the control on the specified instance and returns a value.

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Judy ZhuY Tuesday, February 27, 2018 9:49 AM
    • Unproposed as answer by Judy ZhuY Wednesday, February 28, 2018 9:02 AM
    • Proposed as answer by Judy ZhuY Wednesday, February 28, 2018 9:02 AM
    Monday, February 26, 2018 6:57 AM
  • Hi Judy,

    Thanks for the response. We are using POM and so we have already defined classes for each page.

    Lets take simple example of Excel to understand internal resource. 

    If I can launch Excel two instances and open the same excel file, What happens to the second excel file edit? It says it is read only as someone already started editing it...

    So, the same way we have few resource files, for which I can explicitly ask for write access and release when use is done. When write access is taken for a resource, if another instance requests for write access, system need to show dialog "Cannot provide write access as resource is locked". I need to validate this dialog is shown...

    When I try to execute, though it is launching second instance of the AUT, remaining steps it is trying to do on first instance instead of second instance of AUT. 

    Any Help?

    Thursday, March 8, 2018 1:17 PM
  • Hi Subbu,

    >> When I try to execute, though it is launching second instance of the AUT, remaining steps it is trying to do on first instance instead of second instance of AUT.

    Please use properties to recognition the second instance by hand-coding. Add “Control.DrawHight();” event in your code to highlight the second instance before remaining steps, check the result.

    What is the content of the remaining steps?

    I suggest you could specify the instance name as a parameter, please refer to following snippet code:

    WpfEdit edit=new WpfEdit(second instance’s name); //find the edit control on second instance

    Hope could help you.

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 9, 2018 7:37 AM
  • Wow Wow Wow. 

    I defined parent window class at one location and setting it as parent for all my other UI definitions. With your suggestion, I implemented DIP (Dependency inversion Principle) and made all the constructors take AUT as input. Now I am creating second instance of POM and pass 2nd AUT as Parent and it solved my problem..

    Here is the code:

    public class POM

    {

              ApplicationUnderTest sourceApp;

              public POM()

              {

                      sourceApp = defaultSourceApp; //This is created at assembly level

              }

              public POM(ApplicationUnderTest aut)

              {

                      sourceApp = aut; //This is created at assembly level

              }

    }


    “Realisation is not acquisition of anything new nor is it a new faculty. It is only removal of all camouflage” ― Ramana Maharshi

    Friday, March 9, 2018 1:31 PM