ClickOnce application testing

Dec 8, 2008 at 1:55 PM
Hello-

Has anyone used White for testing ClickOnce applications? I was able to successfully launch a ClickOnce installed application programmatically but when I do, the Application.Name value is a system.Exception null reference message.

Thank you!
Stephen
Dec 8, 2008 at 3:11 PM
My application is a click once as well.  This is what I do to launch the application and use it:



public

static Application app = null;

 

public

static Window window = null;

 

 

 

Application.Launch(PathOfApp);  // which would be the URL

 

 

app = Application.Attach("iexplore");

 

 

window = app.GetWindow(MAINWINDOW, InitializeOption.NoCache.AndIdentifiedBy("mainWindow"));  // MAINWINDOW is the name of the IE window; ex. "white - Discussions - Windows Internet Explorer" for the project White window

 

 

Assert.IsNotNull(window, "Window is null");

 

 

 

Mar 2, 2009 at 7:05 PM
Edited Mar 2, 2009 at 7:07 PM
For those intersted in launching a click once application using the application reference installed in the start menu instead of using the URL you must append ".appref-ms" to the application reference.

Ex.

public const string PATH = @"C:\Documents and Settings\user\Start Menu\Programs\Applications\app_to_test.appref-ms";

Application.Launch(PATH);