Launch browser once for entire test suite CodedUI

  • 1 Replies
  • 1050 Views
Launch browser once for entire test suite CodedUI
« on: April 27, 2016, 15:52:44 pm »
I have written a few tests with COdedUI testing a web app. I want to open the browser once in the solution and close it after all tests are done.

When I run tests while using AssemblyInitialize attribute on a method, with my BrowserWindow.Launch, it keeps throwing exception.

For some reason the code will work fine if its in a TestMethod.

What am I missing ?

*

Ruhit

  • *
  • 22
Re: Launch browser once for entire test suite CodedUI
« Reply #1 on: April 27, 2016, 17:23:00 pm »
If you use ClassInitialize, you have to initialize the playback engine with: Playback.Initialize();

Code
[ClassInitialize]
 public static void LaunchBroswer(TestContext context)
 {         
    Playback.Initialize();
    BrowserWindow browser = BrowserWindow.Launch(new System.Uri(".."));
 }

Hope this helps.

 

Sitemap 1 2 3 4 5 6 7 8