How to Invoke an Application
PROBLEM
I want to invoke a desktop application (i.e. an .exe file) from a test step.
SOLUTION
You can write your own code in a coded step that triggers the application you need. Here's a simple example taken from this article:
C#
System.Diagnostics.Process notePad = new System.Diagnostics.Process();
notePad.StartInfo.FileName = "notepad.exe";
notePad.StartInfo.Arguments = @"c:\myText.txt";
notePad.Start();
Visual Basic
Dim notePad As New System.Diagnostics.Process()
notePad.StartInfo.FileName = "notepad.exe"
notePad.StartInfo.Arguments = "c:\myText.txt"
notePad.Start()
- In the above sample, C:\myText.txt is the argument fed to notepad.exe. If you want to test this sample code, you'll need to create this file on your local disk first. Otherwise, the notepad application will throw a file can't be found error.
- You can also run batch files from a coded step in the same manner.
- Alternatively, you can use a custom .NET assembly in Test Studio Standalone as seen here.