_util.Report Method
JScript | |
---|---|
public function Report( status : uint, method : String, parameters : Object[], details : String ); |
Parameters
- status
The status flag.
A predefined constant (without quotes) or value.
One of:
micPass 0 micFail 1 micDone 2 micWarning 3 - method
- The test object method performed in the test step. If an empty string is passed, the test object method name from the test is used.
- parameters
The parameters for the test object method.
This argument is a SafeArray. To convert an array to a SafeArray, you can use the toSafeArray(array) function that Web Add-in Extensibility provides. This function is defined in <Web_Add-in_Extensibility_installdir>\dat\Extensibility\Web\Toolkits\common.js.
- details
- The details to add to the run results.
The following JavaScript function clicks the specified author name in a WebExtBook object. If the step is performed successfully, the function calls the _util.Report method to add a text string to the run results. Otherwise, the function throws an exception, causing the test to fail.
function GoToAuthorPage(AuthorName)
{
// Look for the specified author name among the children of the first cell
// in the second row and click it.
var bWasFound = false;
for( var i = 0 ; i < _elem.rows[1].cells[0].children.length ; ++i )
{
if( _elem.rows[1].cells[0].children[i].innerText == AuthorName )
{
_elem.rows[1].cells[0].children[i].click();
_util.LogLine("Running GoToAuthorPage test object method.",1);
bWasFound = true;
// Update the report
var params = new Array();
params[0] = AuthorName;
_util.Report(micPass, "GoToAuthorPage", toSafeArray(params), "Author '" + AuthorName + "' was found :-)");
break;
}
}
if( bWasFound == false )
throw ("Author name not found !");
}