Launch AUT code samples (.NET SDK)

The following code samples show how to launch a desktop application using different parameter combinations. To used this capability, you must create an application allowlist file. For details, see Run desktop applications from the OpenText Functional Testing for Developers SDK.

Launch the calc application using its full path and then close the application.

[Test]
public void TestAutFullPath()
{
	IAut calc = Desktop.LaunchAut("C:\\Windows\\System32\\calc.exe");
	//your test code goes here
	calc.Close();
}		

Launch the calc application using only its name.

[Test]
public void TestAutShortcut()
{
	IAut calc = Desktop.LaunchAut("calc");
	//your test code goes here
	calc.Close();
}		

Launch notepad using its name and the file that you want to open.

[Test]
public void TestAutWithArgument()
{
	IAut notepad = Desktop.LaunchAut("notepad", "C:\\Temp\\1.txt");
	//your test code goes here
	notepad.Close();
}		

Launch notepad using two arguments: the file that you want to open and a notepad argument for opening the file in unicode, and the directory where the file resides.

[Test]
public void TestAutWithArgumentsAndWorkingDirectory()
{
	IAut notepad = Desktop.LaunchAut("notepad", new string[] { "/w", "unicode.txt" }, "C:\\Temp");
	//your test code goes here
	notepad.Close();
}			

Describe the environment you need and launch the calc application on a grid node using its name.

                [TestMethod]
public void TestAutShortcutOnGrid()
{
	// Acquire an environment
       var environmentDescription = new EnvironmentDescription();
	environmentDescription.Set("ostype", "Windows");
	var environment = EnvironmentFactory.Get(environmentDescription);
                           
	var calc = environment.LaunchAut("calc");
            
	// Your test code goes here

	calc.Close();
}