Skip to content

Files

Latest commit

Jan 3, 2023
cb9ede8 · Jan 3, 2023

History

History
38 lines (26 loc) · 1.34 KB

File metadata and controls

38 lines (26 loc) · 1.34 KB
title page_title description position
Invoke Application
How to Invoke an Application - Test Studio Dev Documentation
How to Invoke an Application
1

#How to Invoke an Application#

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#]

{{region }}

System.Diagnostics.Process notePad = new System.Diagnostics.Process();
notePad.StartInfo.FileName   = "notepad.exe";
notePad.StartInfo.Arguments = @"c:\myText.txt";
notePad.Start();
{{endregion}}

[VB]

{{region }}

Dim notePad As New System.Diagnostics.Process()
notePad.StartInfo.FileName = "notepad.exe"
notePad.StartInfo.Arguments = "c:\myText.txt"
notePad.Start()
{{endregion}}
  • 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.