Search code examples
c#ui-automationwhite-framework

Getting a Singleton in an Assembly from running TestStack.White.Application


I am using Teststack.White to launch and interact with a GUI. The Model is hidden behind a facade, that allows a testing mock to be injected into the GUI. The GUI successfully loads the testing mock and Teststack.White can launch the application.

How can I access my singleton using the Teststack.White.Application or means of this sort.

enter image description here

    /*Singleton in Mock.DLL that will allow test configurations*/
    class Hook
    {
        public Hook SingleHook { get; private set; } = new Hook();
        private Hook() { }
    }

    /*Loader in Nunit so far*/

    private Application apploader()
    {
        ProcessStartInfo info = new ProcessStartInfo(@"C:\MyGUI\MYWPFGUI.exe");
        info.WorkingDirectory = (@"C:\MyGUI\");
        TestStack.White.Application app = Application.Launch(info);
        return app;
    }

I am currently investigating using AppDomains but since this Application is running in its won process i can not see how I would do that. I need to get a hold of Singleton in order to setup and evaluate my tests.


Solution

  • I think the only way to do that is using some sort of inter process communication.

    There are many example on google on here on SO here or here