_util.ReportEvent Method

Adds information about the results of a step to the run results and to the ALM Last Run Report.

Remarks

Use this method in a JavaScript function that performs a step on a control.

Syntax

JScript 
public function ReportEvent( 
   status : uint,
   method : String,
   parameters : Object[],
   details : String
);

Parameters

status

The status flag.

A predefined constant (without quotes) or value.

One of:

micPass0
micFail1
micDone2
micWarning3
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.

Example

The following JavaScript function clicks the specified author name in a WebExtBook object. If the step is performed successfully, the function calls the _util.ReportEvent method to add a text string to the run results and a line to the ALM Last Run Report. 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.ReportEvent(micPass, "GoToAuthorPage", toSafeArray(params), "Author '" + AuthorName + "' was found :-)");

         break;
       }   
    }
    if( bWasFound == false )
      throw ("Author name not found !");
}