Running a Test from the Command Line

You can run a test from the command line using the PsTestFW command.

Enter a text file argument which contains all the parameters in the command line. The text file is deleted immediately after PTF client reads it. You can write the text file manually or it is generated from the Change Assistant during runtime.

The parameters in the file must follow the below guidelines:

  • Split the parameter and its value with =.

  • Enter each parameter and its value in a new line.

  • Enter each parameter and its value in a single line.

For example, your text file will include the following statements.

-CS=<server>:<port>
-CUA=TRUE
-CO=<userID> 
-CP=<password>
-TST=<TestNameFile>
-TC=DEFAULT
-ACTION=testrun /*testrun value is used for running test.*/
-PFX=
-RTO=<RuntimeOptions>
-LOG=<logfile name>.log

Syntax

Use the following syntax to run the test using a text file argument.

''<Path>\PsTestFw.exe'' ''C:\temp\ptf_cmd_param.txt''

Use the following syntax to run a test using the existing environment connection:

PsTestFw -CD=ConnectionName -CP=ConnectionPassword -TST=TestName
 -TC=TestCaseName [-TL=Line X(integer)][-PFX=Prefix] =RuntimeOption [-LOG=LogFileName][-ACTION=testrun]

Use the following syntax to run a test using specified environment connection parameters:

PsTestFw  -CS=Server -CNO=NodeName -PS=ProxyServer -PU=ProxyUser -PP=ProxyPassword
 -CO=UserName -CP=ConnectionPassword -TST=TestName -TC=TestCaseName [-TL=Line X(integer)]
[-ACTION=testrun] [-PFX=Prefix] =RuntimeOption [-LOG=LogFileName]

Parameters

Field or Control Description

–CD=

Specify the name of the environment login to use for connection. This is the Database Name you would select in the PeopleSoft Test Framework Signon dialog box when signing on to PTF.

The environment login settings are stored in the environments.xml file in the PTF data directory (C:\Documents and Settings\<User>\Application Data\PeopleSoft\PeopleSoft Test Framework by default). If the environment connection data is not set in the environments.xml file, then you can explicitly specify the connection parameters. See the following table for a description of connection parameters.

See Creating a Connection to a PTF Environment.

–CUA=

(Optional) Action on the SSL error. Values are:

  • True– Continue with unsecured connection.

  • False– Cancel the login.

–CP=

Specify the user password.

–TST=

Specify the test name.

–TC=

Specify the test case name.

–TL=

(Optional) Specify the line number from which to start the test.

–PFX=

(Optional) Specify the prefix.

See #PREFIX#

–RTO=

Specify the runtime option to be used in the runtime.

Note: The name of the runtime option must not contain the following characters: space & ? / \ * < > ' "

–ACTION=

(Optional) action type. For test runtime, the value is testrun.

–LOG=

(Optional) Specify the name for the log. The default is unattended.log.

-SOE=

(Optional) Stops runtime if the test encounters an error.

See Using the Test Editor

-LBO=

(Optional) Keeps the PTF-launched browser window open after running a test, to assist with debugging.

See Using the Test Editor

If you do not use the -CD= parameter to specify the connection data, use the parameters in the following table:

Field or Control Description

–CS=

Specify the server:port to connect to. This is the Server:Port value you would enter in the PeopleSoft Test Framework Signon dialog box when signing on to PTF.

–CNO=

Specify the node name.

–CO=

Specify the user name.

–PS=

(Optional) Specify the ProxyServer:Port.

–PU=

(Optional) Specify the proxy user. If you use network authentication, use the DOMAIN\USER format.

–PP=

(Optional) Specify the proxy password.

–ACTION=

(Optional) action type. For test runtime, the value is testrun.

Example

The following example uses the –CD= parameter to set connection parameters:

PsTestFw -CD=QE851 -CP=password -TST=TEST_CMD_LINE -TC=DEFAULT -PFX=Prefix 
=QE851_No_Folder -LOG=my_run_log -ACTION=testrun /*The -ACTION parameter is optional*/

The following example explicitly sets connection parameters:

PsTestFw -CS=rtdc79637vmc:8643 -CNO=PT_LOCAL -PS=ProxyServer:2345 
-PU=mydomain\username -PP=pwd123 -CO=username -CP=password -TST=TEST_CMD_LINE 
-TC=DEFAULT -PFX=Prefix =QE851_No_Folder -LOG=my_run_log -ACTION=testrun /*The -ACTION parameter is optional*/

Log File

The runtime will generate an output log file in the PTF data directory (C:\Documents and Settings\<user>\Application Data\PeopleSoft\PeopleSoft Test Framework by default).

If the log file exists it will be overwritten.

This is an example of a log file:

<runtime>
  <Started>2014-06-18 04:41:46</Started>
  <Param>
    <Database>L921PDVL</Database>
    <TestName>DR_DUMMY_SHELL</TestName>
    <TestCase>DEFAULT</TestCase>
    <ExecOpt>L921PDVL</ExecOpt>
  </Param>
  <Status>Failed</Status>
  <Test>
    <Exec1>
      <Name>DR_DUMMY_LOOP</Name>
      <Case>DEFAULT</Case>
      <LogLine15>case is not DEFAULT2</LogLine15>
      <LogLine16>Runtime stopped by Runtime.Stop_On_Error: 6/18/2014 4:41:54 PM</LogLine16>
      <Status>Failed</Status>
    </Exec1>
    <Exec2>
      <Name>DR_DUMMY_LOOP</Name>
      <Case>DEFAULT2</Case>
      <Status>Passed</Status>
    </Exec2>
    <Exec3>
      <Name>DR_DUMMY_LOOP</Name>
      <Case>DEFAULT3</Case>
      <LogLine44>case is not DEFAULT2</LogLine44>
      <LogLine45>Runtime stopped by Runtime.Stop_On_Error: 6/18/2014 4:41:55 PM</LogLine45>
      <Status>Failed</Status>
    </Exec3>
    <LogFolder>TEST</LogFolder>
    <LogName>4. PS 2014-06-18 16:41</LogName>
    <Message>Runtime stopped by Runtime.Stop_On_Error: 6/18/2014 4:41:55 PM</Message>
  </Test>
</runtime>

Return Code Option For PTF Command Line Runtime

PTF returns an integer value representing the relative success of the runtime, when called from the command line. The integer value is captured by the calling program.

Sample syntax for capturing PTF's integer return value (into a variable in a sample batch file called iRetCode) might be coded as follows:

start /w /MIN PsTestFw -CS=<Environment_server_port> -CNO=<optional_Environment_Node_ID> -CO=<Environment_User_ID> -CP=<Environment_User_Password> -TST=<ShellTest_Name> -TC=<Test Case Name> =<Runtime_options> -LOG=C:\Temp\LOG1.xml set iRetCode=%errorlevel% echo %iRetCode%

Return values are:

Field or Control Description

-1

Failed

-2

Not Completed-FatalError

0

Passed

-3

Starting

-10

Else