Services Object

Description

Enables you to control and monitor how your test runs in conjunction with LoadRunner, or Business Process Monitor. For more details, see the relevant product documentation.

Methods

Method AddWastedTimeIncrements the wasted time for all open transactions.
EndDistributedTransactionMarks the end of a distributed transaction and records the amount of time it took to perform the transaction.
EndTransactionMarks the end of a transaction and records the amount of time it took to perform the transaction.
GetEnvironmentAttributeRetrieves the test's environment properties.
IterationNumberRetrieves the current global iteration number of the test execution.
LogMessageSends a log message according to the appropriate level.
RendezvousSets a rendezvous point in the Vuser script.
SetTransactionReports a completed transaction using manually entered transaction data.
SetTransactionStatusSets the current status for open transactions whose EndTransaction status is set to Auto.
StartDistributedTransactionMarks the start of a distributed transaction for performance analysis.
StartTransactionMarks the beginning of a transaction for performance analysis.
ThinkTimePauses the execution during a test run to simulate the time a real user pauses between actions.
UserDataPointRecords a user-defined data sample for analysis.

Back to top

AddWastedTime Method

Description

Increments the wasted time for all open transactions.

Syntax

Services.AddWastedTime (WastedTimeMs)

Argument

Type

Description

WastedTimeMs

Integer

The amount of time you want to specify as wasted time for each transaction (in milliseconds).

IMPORTANT

In transactions, you use the AddWastedTime method to report the time spent performing operations that are not relevant to the actual process you are testing. You can measure the time spent performing the non-related operation using the MercuryTimer Object.

Back to top

EndDistributedTransaction Method

Description

Marks the end of a distributed transaction and records the amount of time it took to perform the transaction.

Syntax

Services.EndDistributedTransaction UniqueID,Status

Argument

Type

Description

UniqueID

String

The unique ID that tells UFT One when to end the distributed transaction measurement. This value must the same as the value used in the same argument in the corresponding StartDistributedTransaction step. The StartDistributedTransaction method looks for this transaction name to know when to end the distributed transaction measurement.

Note: Use the naming convention for LoadRunner or Business Availability Center transactions, as relevant.

Status

Constant

The distributed transaction completion status. Options:

Pass (0)

Fail (1)

Note: The Auto status is not applicable.

IMPORTANT

You add an EndDistributedTransaction at the point in your test where you want to stop measuring the timing of a task. A distributed transaction enables you to start a transaction in one test and end the same transaction in another test, either within the same Business Process Monitor profile or even in a different profile.

This method is generally used for performance analysis.

Each transaction name should have an associated StartDistributedTransaction and EndDistributedTransaction. The StartDistributedTransaction statement must appear before the associated EndDistributedTransaction. When using two different Business Process Monitor profiles, the profile with the StartDistributedTransaction statement must be run before the profile with the associated EndDistributedTransaction.

Note: There may be cases in which you want to instruct UFT One to perform all the steps in a transaction, even though an error occurs during the run session. In the Run pane of the Test Settings dialog box (File > Settings), select proceed to next step from the When error occurs during run session list.

The EndDistributedTransaction method sends a report that includes the transaction's name, end status, and duration in seconds. If you run the test from LoadRunner or Business Availability Center, you can view the results from the LoadRunner Controller or from Business Availability Center. For details on where to view the results when the test runs from LoadRunner or Business Availability Center, see the relevant product documentation.

Note: If you distribute a transaction across two Business Process Monitor profiles, the run results appear under the profile that contains the StartDistributedTransaction step.

Back to top

EndTransaction Method

Description

Marks the end of a transaction and records the amount of time it took to perform the transaction.

Syntax

Services.EndTransaction Name, [Status]

Argument

Type

Description

Name

String

The name of the transaction.

Note: Use the naming convention for LoadRunner, Business Availability Center, or NV transactions, as relevant.

Status

Constant

Optional. A constant (or number) that specifies the ending status of a transaction. If you do not enter a value, Auto is used.

Auto (2)—Default. Ends the transaction with a Pass status unless an error occurs between StartTransaction and EndTransaction.

Pass (0)—Ends the transaction with a Pass status.

Fail (1)—Ends the transaction with a Fail status.

IMPORTANT

This method is generally used for performance analysis.

During the run session, the StartTransaction step signals the beginning of the time measurement. The time measurement continues until the EndTransaction step is reached. The test results for the EndTransaction step include the transaction's name, end status, total duration, and wasted time.

Wasted time. During a run session, UFT One runs background processes that add to the time it takes to run a test. Wasted time is the time within the total duration that was added as a result of UFT One running the transaction. If the application ran the transaction without UFT One, the total duration would equal the total duration minus the wasted time.

If the test is run from UFT One, you can view the report in the Run Results window. If the test is run from Business Process Monitor or LoadRunner, you can view the results in the relevant location.

Each transaction name should have an associated StartTransaction and EndTransaction. The StartTransaction statement must appear before the associated EndTransaction.

Note: There may be cases in which you want to instruct UFT One to perform all the steps in a transaction, even though an error occurs during the run session. In the Run pane of the Test Settings dialog box (Test > Settings), select proceed to next step from the When error occurs during run session list.

Back to top

GetEnvironmentAttribute Method

Description

Retrieves the test's environment properties.

Syntax

Services.GetEnvironmentAttribute(Attribute)

Argument

Type

Description

Attribute

String

The name attribute you want to retrieve.

IMPORTANT

This method is generally used only when the test runs in conjunction with LoadRunner. For more details, see the relevant product documentation.

Back to top

LogMessage Method

Description

Sends a log message according to the appropriate level, as specified below.

Note: This method is supported only in conjunction with LoadRunner or Business Process Monitor. For more details, see the relevant product documentation.

Syntax

Services.LogMessage Data, [Level]

Argument

Type

Description

Data

String

The message data.

Level

Long

Optional. Use one of the following constants or numbers to specify the message status and where it should be sent:

  • ErrorMsg (7) - set the test status to Fail and consider this an error message.

  • OutputMsg (6) - send the message to the standard Vuser log.

  • StatusMsg(51) - send the message to the Vuser Status field.

If you do not specify a level, the message is treated as OutputMsg.


Rendezvous Method

Description

Sets a rendezvous point in the Vuser script.

Note: This method is supported only when the test runs in conjunction with LoadRunner or Business Process Monitor. For more details, see the specific product documentation.

Syntax

Services.Rendezvous Name

Argument

Type

Description

Name

String

The name of the rendezvous to be inserted in the script.

Back to top

SetTransaction Method

Description

Reports a completed transaction using manually entered transaction data.

Syntax

Services.SetTransaction Name, DurationSec, Status

Argument

Type

Description

Name

String

The name of the transaction.

Note: Use the naming convention for LoadRunner or Business Availability Center transactions, as relevant.

DurationSec

Decimal

The transaction duration in seconds.

Status

Constant

The transaction completion status. Options:

Pass (0)

Fail (1)

Note: The Auto status is not applicable.

IMPORTANT

This method sends a report that includes the transaction's name, end status, and duration in seconds. If the test is run from UFT One, you can view the report in the Run Results window. If the test is run from Business Process Monitor or LoadRunner, you can view the results in the relevant location.

This method is generally used only in conjunction with LoadRunner or Business Process Monitor. For more details, see the relevant product documentation.

Back to top

SetTransactionStatus Method

Description

Sets the current status for open transactions whose EndTransaction status is set to Auto.

Syntax

Services.SetTransactionStatus Status

Argument

Type

Description

Status

Constant

The current status of a transaction. Available options:

Pass (0)

Fail (1)

IMPORTANT

The SetTransactionStatus statement overrides the status of any previous steps in open transactions, including previous SetTransactionStatus statements.

This method is generally used only in conjunction with LoadRunner or Business Process Monitor. For more details, see the relevant product documentation.

Back to top

StartDistributedTransaction Method

Description

Marks the start of a distributed transaction for performance analysis.

Syntax

Services.StartDistributedTransaction TransactionName, UniqueID, Timeout

Argument

Type

Description

TransactionName

String

The name of the distributed transaction.

Note: Use the naming convention for LoadRunner or Business Availability Center transactions, as relevant.

UniqueID

String

The unique ID that tells UFT One when to end the distributed transaction measurement. This value must be unique across all tests and profiles. We recommend that you use a tool to generate a GUID (globally unique identifier). The same unique ID must also be specified in the same argument of the corresponding EndDistributedTransaction step.

Timeout

Integer

The number of seconds to wait before ending the transaction, if the specified EndDistributedTransaction step is not reached.

Note: When using two Business Process Monitor profiles, make sure that the timeout value is large enough so that the profile that contains the StartDistributedTransaction step and all the profiles that run before the profile that contains the EndDistributedTransaction step, will finish running in a time that is less than the value of the specified timeout.

IMPORTANT

You add a StartDistributedTransaction at the point in your test where you want to begin measuring the timing of a task. A distributed transaction enables you to start a transaction in one test and end the same transaction in another test, either within the same Business Process Monitor profile or even in a different profile.

Each transaction name should have an associated StartDistributedTransaction and EndDistributedTransaction. When using two different Business Process Monitor profiles, the profile with the StartDistributedTransaction statement must be run before the profile with the associated EndDistributedTransaction.

Make sure that you relate the tests to a single Business Process Monitor instance. Business Process Monitor searches for the end transaction name in all instances, and may close the wrong distributed transaction if it is included in more than one instance.

If you run the test from LoadRunner or Business Availability Center, you can view the results from the LoadRunner Controller or from Business Availability Center. For details on where to view the results when the test runs from LoadRunner or Business Availability Center, see the relevant product documentation.

Note: If you distribute a transaction across two Business Process Monitor profiles, the run results appear under the profile that contains the StartDistributedTransaction step.

Back to top

StartTransaction Method

Description

Marks the beginning of a transaction for performance analysis.

Syntax

Services.StartTransaction Name

Argument

Type

Description

Name

String

The name of the transaction.

Note: Use the naming convention for LoadRunner, Business Availability Center, or NV transactions, as relevant.

IMPORTANT

You add a StartTransaction at the point in your test where you want to begin measuring the timing of a task.

Each transaction name should have an associated StartTransaction and EndTransaction. The StartTransaction statement must appear before the associated EndTransaction.

If you run the test from UFT One, you can view the results in the Run Results window. If you run the test from LoadRunner or Business Availability Center, you can view the results from the LoadRunner Controller or from Business Availability Center. For details on where to view the results when the test runs from LoadRunner or Business Availability Center, see the relevant product documentation.

Back to top

ThinkTime Method

Description

Pauses the execution during a test run to simulate the time a real user pauses between actions.

Syntax

Services.ThinkTime Seconds

Argument

Type

Description

Seconds

Integer

The number of seconds to pause the test during execution.

IMPORTANT

This method is generally used only in conjunction with LoadRunner or Business Process Monitor. For more details, see the relevant product documentation.


UserDataPoint Method

Description

Records a user-defined data sample for analysis.

Note: This method is supported only in conjunction with LoadRunner or Business Process Monitor. For more details, see the specific product documentation.

Syntax

Services.UserDataPoint Value, Name

Argument

Type

Description

Value

Double

The value to record.

Name

String

The label of the data point as it appears on the graph.

Back to top

See also: