Toolboxcategory cloud |
ViewsPersonal toolsAnalyzing the Script AgentFrom Seapine LabsIf you use another automated testing or scripting tool, you can also schedule and run automated script files through the use of a separate executable, known as a script agent, and a text file for communication between the script agent and TestTrack TCM.
[edit] The ParameterWhen TestTrack TCM starts a script it calls the script agent. TestTrack TCM passes the script agent a single parameter, the full path to the script file. [edit] The script file pathUnder the General category in Tools > Local Options, the TestTrack TCM Automated Scripts Directory is set. This directory is the working area for TestTrack to launch the script file and record the result in the .trjob file.
[edit] Trjob file pathTestTrack TCM looks for the trjob file in the same directory where the script is. It assumes the trjob file has the same name as the script. In the example above, TestTrack TCM is looking for a file called LoginExample.trjob in the C:\scripts\ScheduledScripts\Sample Project\TR28_1_LoginTest\ directory.
[edit] Execution commandThe QA Wizard (and QA Wizard Pro) batch files are stand alone, and that is why in the script agent code it simply sends the full path the script file to the "system". If your script file is not stand alone (you must also tell the system which application is needed to run it), you can edit the command to also include the executable. The command would probably be something like "<Full path to executable> <Full path to script file>".
[edit] The results fileBoth have the "system" run the script, but the QAWProBatAgent also passes a parameter that indicates where to place the report file. The QAWBatAgentApp doesn't do this because the report is always created in a subdirectory under the location of the script file.
[edit] Exit CodesWhen the script agent passes the execution command to the system, it captures the exit code to an integer. The script agent uses this integer to determine the status to enter in the trjob file.
[edit] ExampleThe likelyhood is that most of you will not want to change the source code and use the script agent as is. Note that TestTrack does install exectuables for each version of the script agent. Under the installation directory, you will see a ScriptAgents directory containing several agents, including QAWAppAgent.exe and QAWProAppAgent.exe.
REM Clears the screen CLS @ECHO OFF REM Launches TestComplete, REM executes the specified project REM and closes TestComplete when the run is over "C:\Program Files\Automated QA\TestComplete 6\Bin\TestComplete.exe" "C:\Program Files\Automated QA\TestComplete 6\Samples\Scripts\Hello\Hello.pjs" /u:Hello_VBScript /rt:Hello_VB /run /exit /c IF ERRORLEVEL 3 GOTO CannotRun IF ERRORLEVEL 2 GOTO Errors IF ERRORLEVEL 1 GOTO Warnings IF ERRORLEVEL 0 GOTO Success :CannotRun ECHO The script cannot be run GOTO End :Errors ECHO There are errors GOTO End :Warnings ECHO There are warnings GOTO End :Success ECHO No errors GOTO End :End The batch file calls the TestComplete application and passes parameters including the test suite. Then based on the results (ERROLEVEL), it echoes a status back to the command line.
REM Clears the screen CLS @ECHO OFF REM Launches TestComplete, REM executes the specified project REM and closes TestComplete when the run is over "C:\Program Files\Automated QA\TestComplete 6\Bin\TestComplete.exe" "C:\Program Files\Automated QA\TestComplete 6\Samples\Scripts\Hello\Hello.pjs" /u:Hello_VBScript /rt:Hello_VB /run /exit /c IF ERRORLEVEL 3 GOTO CannotRun IF ERRORLEVEL 2 GOTO Errors IF ERRORLEVEL 1 GOTO Warnings IF ERRORLEVEL 0 GOTO Success :CannotRun ECHO The script cannot be run EXIT 3 GOTO End :Errors ECHO There are errors EXIT 1 GOTO End :Warnings ECHO There are warnings EXIT 2 GOTO End :Success ECHO No errors EXIT 0 GOTO End :End [edit] Suggested enhancements to the Script AgentIf you use TestComplete and feel comfortable working with C++, there are some improvements that would enhance the script agent:
* Using different script status (Passed, Failed, Indetermined) may break the ability to automatically perform a workflow event based on script status. How you modify or use the script agent is a really function of how your scripts are setup, and what you're looking to accomplish with the agent. If you want some assistance in this area, Seapine Services can help you with that. |
|


