Test Script Services

prevnext

Session Services


This section documents functions that may be required by applications. They are not typically used by test scripts.

A suite can contain multiple test scripts of different types. When TestManager executes a suite, a separate session is started for each type of script in the suite. Each session lasts until all scripts of the type have finished executing. Thus, if a suite contains three Visual Basic test scripts and six VU test scripts, two sessions are started and each remains active until all scripts of the respective types finish.

In a given suite run, a session can be run directly (inside the TestManager process space) or by a separate TSS server process (proxy). The latter happens only if the following two conditions are met:


Summary

Applications can use the session functions listed in the following table to manage proxy TSS servers and sessions on behalf of test scripts. These functions are not needed for sessions that are directly executed by TestManager.

Function Description
TSSConnect() Connects to a TSS proxy server.
TSSContext() Passes context information to a TSS server.
TSSDisconnect() Disconnects from a TSS proxy server.
TSSServerStart() Starts a TSS proxy server.
TSSServerStop() Stops a TSS proxy server.
TSSShutdown() Stops logging and initializes TSS.


TSSConnect()

Connects to a TSS proxy server.


Syntax

s32 TSSConnect (char *host, u16 port, s32 id)

Element Description
host The name (or IP address in quad dot notation) of the host on which the proxy TSS server process is running.
port The listening port for the TSS server on host, or 0 (recommended) to let TestManager select the port.
id The connection identifier.


Return Value

This function exits with one of the following results:


Comments

For scripts that are executed by a proxy process rather than directly by the TSEE, this function must be called before any other TSS functions. This function is also required when a script (or TSEA) starts a new thread of execution.

The proxy TSS DLL uses host and port (the host and port parameters passed to SessionOpen() in the TSEA) to establish a connection with the correct TSEE.

The direct TSS DLL ignores host and port, and associates the id with the current execution thread. If the thread already had an ID, id is ignored. (You cannot change id.)


Example

This example connects to a TSS server running on host 192.36.25.107. The port is defined in the example for TSSServerStart().

s32 retVal = TSSConnect ("192.36.25.107",port,0);

See Also

TSSServerStart()


TSSContext()

Passes context information to a TSS server.


Syntax

s32 TSSContext(ContextKey ctx, void *value)

Element Description
ctx The type of context information to pass: Can be one of the following:
  • CTXT_workingDir

  • CTXT_datapoolDir

  • CTXT_timeZero

  • CTXT_todZero

  • CTXT_logDir

  • CTXT_logFile

  • CTXT_logData

  • CTXT_testScript

  • CTXT_style

  • CTXT_sourceUID

value The information of type ctx to pass.


Return Value

This functionexits with one of the following results:


Comments

This call is useful for test scripts that are executed by a stand-alone process -- outside the TestManager framework -- and that also make TSS calls. The call passes information, such as the log file name, that would be passed through shared memory if the script were executed by TestManager.

Test scripts that are executed by a proxy TSS server process should make this call immediately after TSSConnect(), before accessing any other TSS services. Otherwise, inconsistent results can occur.

ContextKey is defined as follows:

enum ContextKey {
	 CTXT_workingDir,
	 CTXT_datapoolDir,
	 CTXT_timeZero,
	 CTXT_todZero,
	 CTXT_logDir
	 CTXT_logFile
	 CTXT_logData
	 CTXT_testScript
	 CTXT_style
	 CTXT_sourceUID
	 CTXT_END
};
typedef enum ContextKey ContextKey;

Example

This example passes a working directory to the current proxy TSS server.

s32 retVal = TSSContext(CTXT_workingDir,"C:\temp");

TSSDisconnect()

Disconnects from a TSS proxy server.


Syntax

void TSSDisconnect (void)

Return Value

None.


Comments

This call closes the connection established by TSSCconnect() and performs any required cleanup operations.


Example

This example disconnects from the TSS server.

TSSDisconnect();

TSSServerStart()

Starts a TSS proxy server.


Syntax

s32 TSSServerStart (u16 *port)

Element Description
port The listening port for the TSS server. If specified as 0 (recommended), the system chooses the port and returns its number to port.


Return Value

This function exits with one of the following results:


Comments

No TSS server is started if one is already running. A test script that is to be executed by a proxy server and that might be the first to execute should make this call.


Example

This example starts a proxy TSS server on a system-designated port, whose number is returned to port.

u16 port = 0;
s32 retVal = TSSServerStart (&port);

See Also

TSSServerStop()


TSSServerStop()

Stops a TSS proxy server.


Syntax

s32 TSSServerStop (u16 port)

Element Description
port The port number that the TSS server to be stopped is listening on.


Return Value

This functionexits with one of the following results:


Comments

In a test suite with multiple scripts, only the last executed script should make this call.


Example

This example stops a proxy TSS server that was started by the example for TSSServerStart().

s32 retval = TSSServerStop (port);

See Also

TSSServerStart()


TSSShutdown()

Stops logging and initializes TSS.


Syntax

s32 TSSShutdown (void)

Return Value

This function exits with one of the following results:


Comments

This call stops logging functions, pauses a playback session, and initializes TSS to resume logging and executing the next task.


Example

This example shuts down logging during session execution so that logging can be restarted for the next task.

s32 retval = TSSShutdown ();

prevnext


Rational TestManager Extensibility Reference Rational Software Corporation
Copyright (c) 2003, Rational Software Corporation http://www.rational.com
support@rational.com
info@rational.com