Tester

Top  Previous  Next

 

Tester object. Use it to perform assertions during test playback and output relevant information to the report. You do not need to record or learn this object, it is always automatically available in any test.

 

 

Property Summary

 

Property

Description

Fail

Test status, test failed.

Info

Test status, test is neither passed nor failed.

Pass

Test status, test passed.

Unresolved

Test status, test status is unresolved, test terminated unexpectedly.

 

Action Summary

 

Action

Description

Assert

Checks if condition is 'true' and saves corresponding Report entry.

AssertEqual

Checks if obj1 equals to obj2 and saves corresponding Report entry.

AssertImage

Checks if 'img1' equals to image stored at 'path' and saves corresponding Report entry.

BeginTest

Marks beginning of a test with a given name.

EndTest

Marks end of a currently executed test.

GetReportAttribute

Gets report attribute previously set by PushReportAttribute or SetReportAttribute.

GetTestStatus

Gets status of currently executed test.

IgnoreStatus

In IgnoreStatus mode the assertion status is always treated as "Info".

Message

Saves corresponding Report message.

MessageBox

Shows message box to user.

MessageBoxPrompt

Shows message box with question to the user and checks if user presses "Yes" or "No" "Yes" => "Pass" goes to the report with this message.

PopReportAttribute

Resets an attribute to its previous value.

PushReportAttribute

Maintains "stacked" attributes.

ResetReportAttribute

Removes report attribute previously set by SetReportAttribute.

SetReportAttribute

Set persistent attribute.

SuppressReport

In SuppressReport mode all assertions are ignored.

 

Property Detail

 

Fail

Test status, test failed. Constant, equal to 0.

 

Info

Test status, test is neither passed nor failed. Constant, equal to -2.

 

Pass

Test status, test passed. Constant, equal to 1.

 

Unresolved

Test status, test status is unresolved, test terminated unexpectedly. Constant, equal to -1.

 

Action Detail

 

Assert(message, condition, data, tags)

Checks if condition is 'true' and saves corresponding Report entry. Assertion is an atomic piece of verification. Assertion may contain some additional data (links, images, comments) set via 'data' parameter

 

Parameters:

 

Name

Type

Description

message

String

Assertion text.

condition

Boolean

If 'true' - assertion is considered Passed.

data

SeSReportLink |
SeSReportText |
SeSReportImage |
Object[] |
String

If "string" is passed, then data is considered as additional comment atribute. Or "array" may be passed. Each entry in the array should be one of: SeSReportLink, SeSReportImage, SeSReportText.
Optional.

tags

Object

Hash of attributes to set for this particular log entry.
Optional.

 

AssertEqual(message, obj1, obj2, data, tags)

Checks if obj1 equals to obj2 and saves corresponding Report entry. Assertion is an atomic piece of verification. Assertion may contain some additional data (links, images, comments) set via 'data' parameter

 

Parameters:

 

Name

Type

Description

message

String

Assertion text.

obj1

Object

First object to compare.

obj2

Object

Second object to compare.

data

SeSReportLink |
SeSReportText |
SeSReportImage |
Object[]

If "string" is passed, then data is considered as additional comment atribute. Or "array" may be passed. Each entry in the array should be one of: SeSReportLink, SeSReportImage, SeSReportText.
Optional.

tags

Object

Hash of attributes to set for this particular log entry.
Optional.

 

AssertImage(message, img1, path, data, tags)

Checks if 'img1' equals to image stored at 'path' and saves corresponding Report entry. Assertion is an atomic piece of verification. Assertion may contain some additional data (links, images, comments) set via 'data' parameter

 

Parameters:

 

Name

Type

Description

message

String

Assertion text.

img1

Object

ImageWrapper object (1st image to compare).

path

ImageWrapper

Path to the second image to compare.

data

SeSReportLink |
SeSReportText |
SeSReportImage |
Object[]

If "string" is passed, then data is considered as additional comment atribute. Or "array" may be passed. Each entry in the array should be one of: SeSReportLink, SeSReportImage, SeSReportText.
Optional.

tags

Object

Hash of attributes to set for this particular log entry.
Optional.

 

BeginTest(name, path)

Marks beginning of a test with a given name.

 

Parameters:

 

Name

Type

Description

name

String

Test name.

path

String

Optional. Path to the test, that is executed. This string will be shown as a comment.

 

EndTest()

Marks end of a currently executed test. Calculates test results and performs finalization of test execution.

 

GetReportAttribute(name)

Gets report attribute previously set by PushReportAttribute or SetReportAttribute.

 

Parameters:

 

Name

Type

Description

name

String

Atribute name.

 

GetTestStatus()

Gets status of currently executed test.

 

Returns:

 

One of:
Tester.Infotest is neither passed nor failed
Tester.Passtest passed
Tester.Failtest failed
Tester.Unresolvedtest status is unresolved, test terminated unexpectedly

 

IgnoreStatus(ignore)

In IgnoreStatus mode the assertion status is always treated as "Info". Real status is written to "realStatus" attribute in this case and used just for information purposes (i.e. it does not affect final test status).

This function is used when the test case needs to set test status manually.

Tester.IgnoreStatus(true);
Tester.Assert("Ignored Assertion", false); // This assertion is failed. But its status is ignored.
Tester.IgnoreStatus(false);
Tester.Assert("Test passed", true);
// The overall test is passed because failed assertion is ignored.

 

Parameters:

 

Name

Type

Description

ignore

Boolean

'true' to ignore status of all report items.

 

Message(message, data, tags)

Saves corresponding Report message. Message may contain some additional data (links, images, comments) set via 'data' parameter.

 

Parameters:

 

Name

Type

Description

message

String

Mesage text.

data

SeSReportLink |
SeSReportText |
SeSReportImage |
Object[]

If "string" is passed, then data is considered as additional comment atribute Or "array" may be passed. Each entry in the array should be one of: SeSReportLink, SeSReportImage, SeSReportText.
Optional.

tags

Object

Hash of attributes to set for this particular log entry.
Optional.

 

MessageBox(message)

Shows message box to user. Use it for verbose and manual testing.

 

Parameters:

 

Name

Type

Description

message

String

Message text.

 

MessageBoxPrompt(question)

Shows message box with question to the user and checks if user presses "Yes" or "No" "Yes" => "Pass" goes to the report with this message. "No" => "Fail" is reported.

 

Parameters:

 

Name

Type

Description

question

String

Question text.

 

PopReportAttribute(name)

Resets an attribute to its previous value. See PushReportAttribute for more information.

 

Parameters:

 

Name

Type

Description

name

String

Attribute name.

 

Returns:

 

Previous value. Null if no such stacked attribute found.

 

PushReportAttribute(name, value)

Maintains "stacked" attributes. Useful for nesting.


Example:


Main test sets atscenario=Main. Then it calls another scenario (scenario Login) and then continues its own test actions.


We want all assertions to be attributed with current scenario name.

 function Main()
 {
     Tester.PushReportAttribute("scenario", "Main");
     Login();
     ...
     Tester.Assert("Main test passed", mainStatus); // Saved with scenario=Main
 }

 function Login()
 {
     Tester.PushReportAttribute("scenario", "Login");
     ... // Do login logic
     Tester.Assert("Login Result", loginStatus);
     Tester.PopReportAttribute("scenario"); // Set scenario value back to caller
	}

 

Parameters:

 

Name

Type

Description

name

String

Attribute name.

value

String

Attribute value.

 

ResetReportAttribute(name)

Removes report attribute previously set by SetReportAttribute.

 

Parameters:

 

Name

Type

Description

name

String

Atribute name.

 

SetReportAttribute(name, value)

Set persistent attribute. It will be set for all subsequent report items (assertions, tests, requirements, and so on). It may be changed by calling the ResetReportAttribute function.

 

Parameters:

 

Name

Type

Description

name

String

Attribute name.

value

String

Attribute value.

 

SuppressReport(suppress)

In SuppressReport mode all assertions are ignored. That means no lines are added to report and all statuses are treated as "Info". This mode is like IgnoreStatus mode but no status messages are added to report.

Tester.SuppressReport(true);
Tester.Assert("No assertion", false); // Status of this assertion will be ignored and no record will be added to report
SeS('Obj1').DoClick(); // No line will be added to report and operation status will be ignored
Tester.SuppressReport(false);

 

Parameters:

 

Name

Type

Description

suppress

Boolean

'true' to suppress report of all report items.