locked
CUIT Combining Windows Store Projects and non-Windows Store Projects RRS feed

  • Question

  • Hi,

    I have written a bunch of Coded UI Tests using the VS2017 "Coded UI Test Project" template (lets call this Project A), and then realised I needed some that use the "Coded UI Test Project (Universal Windows)" template, so I added this as a second project type in my solution (lets call this Project B). 

    In project A, I reference DLL Microsoft.VisualStudio.TestTools.UITesting and in project B I reference DLL Microsoft.VisualStudio.TestTools.WindowsStore.UITesting (referenced automatically on project creation).

    In an attempt to eliminate having two dll executables and two config files, I thought maybe I could combine the two into the Universal Windows project (project B). However, it turns out the WindowsStore version of the DLL has everything but the “BrowserWindow” components. I tried to reference in the original DLL from Project A instead so I could use the BrowserWindow but it does not have the XAML control components I need for the Windows Store tests. Then I tried to include both dlls, but both dlls use the same namespace (the WindowsStore one does NOT include WindowsStore in it’s namespace) so I get errors for all other components such as “Playback” that it exists in both places.

    Is there any way around this? Or you’re just forced to have two separate projects?

    Another option I tried was to leave the two projects separate, which means two dll’s which I can live with, but make the App.Config files point to a common external config so that settings only have to be edited in one place if they have to be changed. I have set this external config file to be copied to the executable location, however when I run a CUIT test, it temporarily copies files to it’s own location but doesn’t include the file I created and I end up with this type of error:

    Message: Unit Test Adapter threw exception: Unable to open configSource file 'RunTests.config'. (C:\ \FunctionalTest\Source\TestResults\abc32_2017-08-16 15_13_19\Out\ProjectA.DLL.config

    Thanks,

    Renae.

    Wednesday, August 16, 2017 6:13 AM

All replies

  • Hi Renae123,

    Welcome to MSDN forum.

    >> Is there any way around this? Or you’re just forced to have two separate projects?

     “Microsoft.VisualStudio.TestTools.UITesting” in Coded UI Test Project is for UITestControl.

    Microsoft.VisualStudio.TestTools.WindowsStore.UITesting” in Coded UI Test Project (Universal Windows) is for XamlControl.

    These are two types of controls, so we couldn’t combine them as one. To use BrowserWindow, we need use assembly “Microsoft.VisualStudio.TestTools.UITesting”. We could not use BrowserWindow in coded UI test project (Universal Windows).

    There are several ways to open a browser in coded UI test project (Universal Windows) without use "Browserwindow" component.

    1. Launch the edge browser use the automation ID property identification use coded UI test builder.

    XamlWindow.Launch("Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge");  

    2. Use system process to launch the default browser.

    System.Diagnostics.Process.Start("http://www.google.com"); 

    3. Use Selenium WebDriver to launch browser, Please refer to following steps:

    • Please install “Selenium components for Coded UI Cross Browser Testing”.
    • Add assemblies “WebDriver.dll” and “WebDriver.Support.dll” to project reference.
    • Add existing item chromedriver.exe from “C:\Program Files (x86)\Common Files\Microsoft Shared\VSTT\Cross Browser Selenium Components”, set it’s properties “Copy to Output Directory = Copy always”.
    • Then, we could use them refer to below
    using OpenQA.Selenium;
    
    using OpenQA.Selenium.Chrome;
    
    using OpenQA.Selenium.Remote; 
    
    IWebDriver driver = new ChromeDriver("C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\VSTT\\Cross Browser Selenium Components");
    
    driver.Url = "https://www.bing.com/";

    >>I have set this external config file to be copied to the executable location, however when I run a CUIT test, it temporarily copies files to it’s own location but doesn’t include the file I created and I end up with this type of error

    In order to make the additional files (such as configuration files) available for the test, we have to specify that they are to be deployed. Please refer to following MSDN document for more information:

    https://msdn.microsoft.com/en-us/library/ms182475.aspx

    Hope it helps.

     

    Best regards,

    Fletcher


    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.


    • Edited by Fletch Zhou Thursday, August 17, 2017 5:41 AM
    • Proposed as answer by Fletch Zhou Friday, August 18, 2017 8:41 AM
    Thursday, August 17, 2017 5:41 AM
  • Hi Fletcher,

    I have not had a look at (3) above but I think (1) and (2) don't give as many options as BrowserWindow, for example we call some of the functions like ClearCookies, ClearCache, PerformDialogAction.

    Thanks,

    Renae

    Monday, August 21, 2017 1:09 AM
  • Hi Renae,

    Thanks for you response.

    You are right, it's really a limitation in Visual Studio. That's why I suggest you try the Selenium if it's ok.

    And of course, you could summit a feedback(Go to Help->Send Feedback) to Microsoft VS team, they might consider combine the two kinds for project in the future release of VS.

    Thanks for your understanding.

     

    Best regards,

    Fletcher


    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.


    • Edited by Fletch Zhou Monday, August 21, 2017 2:52 AM
    Monday, August 21, 2017 2:52 AM