Tester¶
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. |
CaptureDesktopImage | Captures image of the desktop and adds it to the report. |
CaptureObjectImage | Captures image of an object and adds it to the report. |
CaptureWindowImage | Captures image of an application window matched by title and class and adds it to the report. |
DumpCmdArgsJson | Dump node.json with all arguments. |
EndTest | Marks end of a currently executed test. |
FailTest | Stops test execution and sets it's status to failed. |
GetParam | Read parameter field passed into the Test function by field name. |
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". |
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.
Type: number
Info¶
Test status, test is neither passed nor failed. Constant, equal to -2.
Type: number
Pass¶
Test status, test passed. Constant, equal to 1.
Type: number
Unresolved¶
Test status, test status is unresolved, test terminated unexpectedly. Constant, equal to -1.
Type: number
Action Detail¶
Assert¶
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.
Assert(message, condition, data, tags)
Parameters:
Name | Type | Description |
---|---|---|
message | string | Message to put in the report. |
condition | boolean | If 'true' - assertion is considered passed. |
data | SeSReportLink | SeSReportText | SeSReportImage | object[] | string | Additional information to put in the report. 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¶
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.
AssertEqual(message, obj1, obj2, data, tags)
Parameters:
Name | Type | Description |
---|---|---|
message | string | Message to put in the report. |
obj1 | object | First object to compare. |
obj2 | object | Second object to compare. |
data | SeSReportLink | SeSReportText | SeSReportImage | Object[] | Additional information to put in the report. 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¶
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.
AssertImage(message, img1, path, data, tags)
Parameters:
Name | Type | Description |
---|---|---|
message | string | Message to put in the report. |
img1 | object | ImageWrapper object (1st image to compare). |
path | string | Path to the second image to compare. |
data | SeSReportLink | SeSReportText | SeSReportImage | Object[] | Additional information to put in the report. 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¶
Marks beginning of a test with a given name.
BeginTest(name, path, optionalParams)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Test name |
path | string | Path to the test, that is executed. This string will be shown as a comment. Optional. |
optionalParams | object | Params to pass into Test(...) function. Optional. |
CaptureDesktopImage¶
Captures image of the desktop and adds it to the report.
CaptureDesktopImage(caption)
Parameters:
Name | Type | Description |
---|---|---|
caption | string | Image title for the report. |
CaptureObjectImage¶
Captures image of an object and adds it to the report.
CaptureObjectImage(caption, objId)
Parameters:
Name | Type | Description |
---|---|---|
caption | string | Image title for the report. |
objId | objectId | Id of an object or SeSObject instance. |
CaptureWindowImage¶
Captures image of an application window matched by title and class and adds it to the report.
CaptureWindowImage(caption, windowTitle, windowClass, bringToFront)
Parameters:
Name | Type | Description |
---|---|---|
caption | string | Image title for the report. |
windowTitle | string | String or regular expression to match window title. |
windowClass | string | String or regular expression to match window class. Optional, Default: regex:.*. |
bringToFront | boolean | Set to 'false' to not restore the window before making the image. Optional, Default: true. |
DumpCmdArgsJson¶
Dump node.json with all arguments.
DumpCmdArgsJson(optNodeJsonPath, mkPackageJson)
Parameters:
Name | Type | Description |
---|---|---|
optNodeJsonPath | string | node.json path Optional. |
mkPackageJson | bool |
EndTest¶
Marks end of a currently executed test. Calculates test results and performs finalization of test execution.
EndTest()
FailTest¶
Stops test execution and sets it's status to failed.
FailTest(message, internal)
Parameters:
Name | Type | Description |
---|---|---|
message | string | Failure description. Optional, Default: Test stopped on error. |
internal |
GetParam¶
Read parameter field passed into the Test function by field name.
GetParam(paramName, defaultValue)
Parameters:
Name | Type | Description |
---|---|---|
paramName | string | |
defaultValue | string | Default value |
GetReportAttribute¶
Gets report attribute previously set by PushReportAttribute or SetReportAttribute.
GetReportAttribute(name)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Attribute name. |
GetTestStatus¶
Gets status of currently executed test.
GetTestStatus()
Returns:
One of: Tester.Info - test is neither passed nor failed; 1 - Tester.Pass - test passed; 0 - Tester.Fail - test failed; -1 - Tester.Unresolved - test status is unresolved, test terminated unexpectedly.
IgnoreStatus¶
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.
IgnoreStatus(ignore)
Parameters:
Name | Type | Description |
---|---|---|
ignore | boolean | Set to 'true' to report all messages but ignore the status (Pass/Fail) |
Message¶
Saves corresponding Report message. Message may contain some additional data (links, images, comments) set via 'data' parameter.
Message(message, data, tags)
Parameters:
Name | Type | Description |
---|---|---|
message | string | Message to put in the report |
data | SeSReportLink | SeSReportText | SeSReportImage | Object[] | Additional information to put in the report. 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¶
Shows message box to user. Use it for verbose and manual testing.
MessageBox(message)
Parameters:
Name | Type | Description |
---|---|---|
message | string | Message to display. |
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. "No" => "Fail" is reported.
MessageBoxPrompt(question)
Parameters:
Name | Type | Description |
---|---|---|
question | string | Question to display. |
PopReportAttribute¶
Resets an attribute to its previous value. See PushReportAttribute for more information.
PopReportAttribute(name)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Attribute name to recall from stack. |
Returns:
string: Previous value. Null if no such stacked attribute found.
PushReportAttribute¶
Maintains "stacked" attributes. Useful for nesting.
Example:
Main test sets scenario=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 }
PushReportAttribute(name, value)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Attribute name to recall from stack. |
value | string | New attribute value. |
ResetReportAttribute¶
Removes report attribute previously set by SetReportAttribute.
ResetReportAttribute(name)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Attribute name. |
SetReportAttribute¶
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.
SetReportAttribute(name, value)
Parameters:
Name | Type | Description |
---|---|---|
name | string | Attribute name to set. |
value | string | New attribute value. |
SuppressReport¶
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);
SuppressReport(suppress)
Parameters:
Name | Type | Description |
---|---|---|
suppress | boolean | Set to 'True' to suppress adding anything into the report. |