Namespace: reporters

hobs. reporters

Result formating utils

Properties:
Name Type Description
TXT string

Human readable text format

HTML string

HTML format

JUNIT_XML string

XML format following https://svn.jenkins-ci.org/trunk/hudson/dtkit/dtkit-format/dtkit-junit-model/src/main/resources/com/thalesgroup/dtkit/junit/model/xsd/junit-4.xsd. You can use this format to get test result report in Jenkins CI.

Methods


<static> formatResult(result, format)

Processes Hobbes.js result objects into different formats

Parameters:
Name Type Description
result object

An Hobbes.js result object (see hobs.TestSuite, hobs.TestCase)

format hobs.utils.resultOutput

The format of the output hobs.utils.resultOutput

Returns:

A String representation the test element result in the chosen format

Type
string
Example

Get formatted report of TestCase execution

var tc = new hobs.TestCase('tc')
                     .navigateTo('sample-iframe.html')
                     .click('button')
                     .asserts.exists('#b1');

var tcRes = null;

// Asynchronous execution of the TestCase
tc.exec().then(function() {
     tcRes = tc.result();
});

// Wait until the test case got executed, then

// TXT report
hobs.reporters.formatResult(tcRes, hobs.reporters.TXT);
// [TC] tc (duration: 0.182s.)
//   1 [V] navigateTo : URL[sample-iframe.html]
//   2 [V] click : clicked ELEMENT[button]
//   3 [V] asserts exists : assert ELEMENT[#b1] does [] exist in the DOM

// HTML report
hobs.reporters.formatResult(tcRes, hobs.reporters.HTML);

// JUNIT XML report
hobs.reporters.formatResult(tcRes, hobs.reporters.JUNIT_XML);