VirtualUser RecordTransaction Method (String, Int32, Int32, Boolean, VirtualUserScript)C# API
Records a transaction in the VU event log, specifying whether the transaction passed.

Namespace: Facilita.Fc.Runtime
Assembly: fc_clr (in fc_clr.dll) Version: 9.5.7.98
Syntax

public void RecordTransaction(
	string id,
	int startTime,
	int duration,
	bool pass = true,
	VirtualUserScript script = null
)

Parameters

id
Type: System String
The transaction identifier.
startTime
Type: System Int32
The time at which the transaction started, measured in milliseconds since the start of the test run.
duration
Type: System Int32
The duration of the transaction, in milliseconds.
pass (Optional)
Type: System Boolean
true if the transaction should be interpreted as a pass; otherwise, false.
script (Optional)
Type: Facilita.Fc.Runtime VirtualUserScript
The currently executing VirtualUserScript.
Remarks

The recommended way to record a transaction is by using the StartTransaction(String, String, VirtualUserScript) and EndTransaction(String, Boolean, String, VirtualUserScript) methods.

This method is useful if you need to measure a transaction where the start time and/or the transaction name are not known at the point the transaction starts. For example, you may wish to record a different transaction name depending on the result of a particular call to the SUT.

Examples

The following example demonstrates recording a transaction with a different name, depending on the return value of a method.
int startTime = this.ElapsedTime;
bool result = DoSomething();
int duration = this.ElapsedTime - startTime;

// Transaction name differs, depending on the result of the call         
if (result)
{
    RecordTransaction("transaction1", startTime, duration, true);
}
else
{
    RecordTransaction("transaction2", startTime, duration, false);
}
See Also