Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6552645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:29:07+00:00 2026-05-25T12:29:07+00:00

I have created an integration test using the White automation framework. This is the

  • 0

I have created an integration test using the White automation framework. This is the start of the integration test:

var app       = Application.Launch("WPFIntegrationTest.exe");
var window    = app.GetWindow("MainWindow");

However, I would like to get an instance of White.Core.UIItems.WindowItems.Window without ‘launching’ the application in a new process. This would then allow me to inject any dependencies that MainWindow has, so that I can selectively mock/stub them out.

As an example of what I’m looking for, this is the code I wish I could write:

var myWindow  = new MainWindow();
var window    = White.Core.UIItems.WindowItems.Window(myWindow);

Is there any way I can achieve this using the White automation framework?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:29:07+00:00Added an answer on May 25, 2026 at 12:29 pm

    It sounds like what you’re describing is running your White test code and the application under test in the same process – is that the case?

    From what I can tell the White author discourages that – see question #9 on this White FAQ page:

    http://white.codeplex.com/wikipage?title=Other%20questions

    Can white test run in the same process as the application?

    No. White is not designed to work in this mode as this can cause threading issues. All in principle it is not a good idea to couple test code with application under test code as they would evolve independent from each other.

    Still, maybe the article below will help you do what you want:

    http://msdn.microsoft.com/en-us/magazine/cc163864.aspx

    In the above article, check the code in “Figure 5 – Launching the App”.

    The author’s approach seems a little like what you’re describing – his code appears to load an assembly, use it to create an instance of a Form object, then launch a separate thread in which Application.Run is called to launch the Form.

    Once your AUT is running, you should be able to attach to it using White in the main thread.

    Perhaps that technique will get you started on manipulating the AUT the way you were hoping to do?

    Just for convenience here’s Figure 5 from the article:

    static Form LaunchApp(string exePath, string formName)
    {
      Thread.Sleep(delay);
      Assembly a = Assembly.LoadFrom(exePath);
      Type formType = a.GetType(formName);
      Form resultForm = (Form)a.CreateInstance(formType.FullName);
      Thread t = new Thread(new ThreadStart(new AppState(resultForm).RunApp));
      t.ApartmentState = ApartmentState.STA;
      t.IsBackground = true;
      t.Start();
      return resultForm;
    }
    
    private class AppState
    {
      public AppState(Form f) { FormToRun = f; }
      public readonly Form FormToRun;
      public void RunApp()
      {
        Application.Run(FormToRun);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the latest version of protobuf-net with VS2008 integration. I have created
We have been using TeamBuild and test for our continuous integration build for about
I have created a custom dialog for Visual Studio Setup Project using the steps
I have created a C# class file by using a XSD-file as an input.
I have an automated integration test harness and would like to streamline the logging
I am running my tests for a rails application using test/unit and capybara. I
Hi I have a very simple integration test require 'integration_test_helper' Capybara.current_driver = :rack_test class
I'm trying to write a Sign in integration test for my app + devise
We have been building our Flex app forever using Maven. Due to the fact
I have an integration test the sends a simple GET request to the 'show'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.