Process Operations

The folder TBox Automation Tools->Process Operations in the Standard subset contains the following Modules:

TBox Start Program

This Module allows you to open an application or an executable file stored in a Microsoft Windows® file system. You can also use it to shut down an application via command line (see example 5).

It has the following ModuleAttributes:

ModuleAttribute

Description

Path

Path to the application that you want to open or an environment variable. To shut down an application, enter the name of the command line task.

This entry is mandatory.

Directory

Specify a working directory for the program. By default, Tricentis Tosca uses the home directory of the registered user: C:\Documents and Settings\<user name>.

Arguments

If you want to start or stop the application via arguments, specify arguments.

Arguments->Argument

Define an argument and use ActionMode Input.

To shut down an application, one of the arguments must be its name according to the Details tab in Windows Task Manager.

You can specify multiple arguments, one per sub-ModuleAttribute.

WaitforExit

You can instruct Tricentis Tosca to wait until the application has been exited. To do so, set the value True and use ActionMode Select.

Optionally, specify StandardOutputFile, TimeoutForExit, and ExitCode.

WaitforExit->StandardOutputFile

If you want Tricentis Tosca to create a log, specify the path and name of the log file.

The log includes standard output (stdout) and standard error (stderr).

WaitforExit->TimeoutForExit

Specify the maximum time in seconds that Tricentis Tosca should wait before exiting the application.

WaitforExit->ExitCode

Verify your application's exit code. To do so, enter the code into the Value column and use ActionMode Verify.

Run as

Define which domain or local user credentials Tricentis Tosca should use to open the application.

By default, Tosca Commander chooses ActionMode Select.

Run as->Username

User Principal Name (UPN) format of the user name that should open the application.

For example: jdoe@company.com.

Run as->Password

If needed, specify the password of the user.

In this example, you start the application Notepad.exe, which is located at C:\Windows.

To do so, Tricentis Tosca uses the user credentials of John Doe as specified in Username and Password.

In this example, you open the file Test01.xml, which is located at D:\, with the program notepad.exe, which is located at C:\Windows.

The defined working directory is C:\Temp.

In this example, you start Google Chrome and open the website www.tricentis.com in private mode:

In this example, you start TCShell.exe, which is located at %COMMANDER_HOME%.

Additionally, Tricentis Tosca performs the following actions:

  • Waits until the application has exited

  • Verifies the application's ExitCode: 0

  • Creates a log file named log.txt and saves it to %TEMP%

In this example, you start TCShell.exe, which is located at %COMMANDER_HOME%.

Additionally, Tricentis Tosca performs the following actions:

  • Waits until the application has exited

  • Verifies the application's ExitCode: 0

  • Creates a log file named log.txt and saves it to %TEMP%

In this example, you use the Windows command line task TaskKill (link opens in new tab) to shut down Chrome, forcibly and immediately.

TBox Close Program

The Module TBox Close Program lets you do the following things: 

  • Close an application or process.

  • Wait until an application has closed.

  • Verify whether an application or process is currently running.

This is helpful whenever you need to end an application before you can proceed with the next TestStep.

The Module has the following ModuleAttributes:

ModuleAttribute

Description

Id*

Process identification number (PID) of the application. Example: 7588.

Name*

Process name of the application. Example: msedge.

Main Window Title*

Title of the main application window. Example: Slack.

Command Line

Optionally, fine-tune identification by entering the command line parameters you execute your application with. If you're only interested in specific parts of the parameter set, use wildcards.

Operation

Choose the operation you want to perform:

  • Close if Exist: Closes the specified application or process. If the application or process doesn't exist—or if Tricentis Tosca can't find it—the TestCase passes with nothing to close.

  • Close: Closes the specified application. If the specified application isn't running, the TestCase fails.

  • Wait on Close: Waits until the specified application is closed by another process or user. Tricentis Tosca waits for the length of time you've specified in the setting TBox > Synchronization > SynchronizationTimeout.

  • Verify Program Exists: Verifies if the specified application or process is currently running.

*You need to specify at least one of these values in your TestCase so that Tricentis Tosca can find the correct application or process. If you have multiple applications or processes with equal or similar identifiers, use more than one of these identifiers in your TestCase.

In this example, you verify whether an application exists whose window title contains Notepad. To do this, you use wildcards *.

Close an application that contains Notepad in its window title

In this example, you close the Notepad application that you previously opened with the command notepad a.txt.

Close an application that you opened with parameters using the command line