Offline execution - The test execution batch file
From a TestArchitect client session, you can generate a batch file that invokes the command line tool to perform your tests.
In Windows, the generated batch file to execute a test only single controller has this form:
:TAExecute0 @echo off title TestArchitect - Command Line Tool ta execute [TACommandLine.jar command line1] exit
The Windows batch commands and keywords in the file are as follows:
The colon (:) designates a batch file label which, in this case, is TAExecute0. Labels serve as reference points in a batch file for other lines in the file, usually as
go topoints. For a single-controller batch file, the label does not have any practical use. It does come into play for multiple-controller batch files, however, as will be discussed later.
Instructs the batch file interpreter not to display any future commands to the screen.
title TestArchitect - Command Line Tool
The command line window’s title is assigned the name TestArchitect - Command Line Tool.
Exit and close the command line/terminal.
The Execute Test dialog box affords you the option to direct your test to be executed on more than a single controller concurrently. When you generate a batch file for multiple controllers, TestArchitect loads it with separate TACommandLine lines which are identical except for the -c ( Machine name or IP address, and port number of the TestArchitect controller that is to run the test) argument.
As an example, the Windows batch file for a three-controller test run might take the following form:
if not "%1" == "" goto :%1 start "TAExecute0" cmd /k "%~dpfx0" TAExecute0 start "TAExecute1" cmd /k "%~dpfx0" TAExecute1 exit :TAExecute0 @echo off title TestArchitect - Command Line Tool ta execute [TACommandLine.jar command line1] exit :TAExecute1 @echo off title TestArchitect - Command Line Tool ta execute [TACommandLine.jar command line1] exit
Some of the lines not seen earlier include:
if not “%1” == "" goto :%1
This allows for an optional parameter (represented by
%1) to be passed to the batch file to allow it to execute on one and only one of the controllers specified within it. For example, were the above batch file to be named Calculation.bat, the command
Calculation.bat TAExecute2would cause the test to run only on the controller specified in the last block of the batch file.
start “TAExecute<Number>” cmd /k “%~dpfx0” TAExecute<Number>
Without delving into details, each start command launches a separate instance of Windows' cmd shell, which then launches the batch code for the TACommandLine execution for one of the specified controllers. By using start to launch each controller-specific test, you ensure that the three tests run asynchronously. (Without start, each test would not begin until the one before it completed.)
As with multiple controllers, you can elect from the Execute Test dialog box to execute a test on multiple devices. The generated batch file looks similar to that of one of the above two cases (depending upon whether one or multiple controllers are involved). For each TACommandLine, an additional argument, -d, is applied, to specify one or more devices attached to the respective controller.
- /d “<Device Name 1>;<Device Name 2>"
When you specify a serial test run, a separate TACommandLine line is generated for each test module. (One exception, discussed below, is when you specify a test suite and accept the default of running all test module sections and test cases.) In the event that you are also specifying multiple hardware targets (controllers or devices), the number of command lines is multiplied accordingly. For example, we can expand on the above example of executing on three controllers by also specifying two test modules, tm01 and tm02:
1 For full details of the TACommandLine structure and its arguments, see Command options.
:TAExecute0 @echo off title TestArchitect - Command Line Tool ta execute [TACommandLine.jar command line for tm011] ta execute [TACommandLine.jar command line for tm021] exit :TAExecute1 @echo off title TestArchitect - Command Line Tool ta execute [TACommandLine.jar command line for tm011] ta execute [TACommandLine.jar command line for tm021] exit :TAExecute2 @echo off title TestArchitect - Command Line Tool ta execute [TACommandLine.jar command line for tm011] ta execute [TACommandLine.jar command line for tm021] exit