new tryCatch(fct [, expectThrow] [, options])
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
fct |
function | The function that will be executed in a try catch block |
||
expectThrow |
boolean |
<optional> |
false | Control whether the function is expected to throw an exception or not |
options |
TestStepOptions |
<optional> |
Test method options (Accepts: "delay") |
Extends
Methods
-
cancel()
-
Cancels step execution
- Inherited From:
-
clone()
-
Returns a clone of the teststep
- Inherited From:
Returns:
- Type
- hobs.TestStep
-
done(state, result)
-
Completes step execution
Parameters:
Name Type Description state
string The final state of the step
result
object The result of the step execution
- Inherited From:
-
duration( [format])
-
Get the duration of the test step execution
Parameters:
Name Type Argument Default Description format
string <optional>
'ms' Specific format to convert the duration to. By default, milliseconds
- Inherited From:
Returns:
The duration of execution in a specific format. Returns -1 if the test step has not been completely executed.
- Type
- number
-
exec( [options])
-
Executes the step. It consists of executing the function passed to the constructor.
Parameters:
Name Type Argument Description options
Object <optional>
Extra properties, extending the ones set at the instantiation of the step and passed, as first argument, to the step function.
- Inherited From:
Returns:
A promise
- Type
- Object
-
execData(key, value)
-
Get/set execution metadata of the test step
Parameters:
Name Type Description key
string The name of the option property
value
* The value to set the option property to
- Inherited From:
Example
// Init TestStep var step = new hobs.TestStep('ts1', 'Test Step #1'); // Execution metadata is set to an empty object by default // Get all the options as an Object step.execData(); // => {} // Get the value of a specific option property step.execData('prop1'); // => 'string' step.execData('prop2'); // => 12 // Set the value of a specific option property step.execData('prop1', true); step.execData('prop2', 123); step.execData(); // => {prop1: true, prop2: 123}
-
options(name, value)
-
Get/set options of the step
Parameters:
Name Type Description name
string The name of the option property
value
* The value to set the option property to
- Inherited From:
Example
// Init Step with options var step = new hobs.Chaining.Step(null, {prop1: 'string', prop2: 12}); // Get all the options as an Object step.options(); // => {prop1: 'string', prop2: 12} // Get the value of a specific option property step.options('prop1'); // => 'string' step.options('prop2'); // => 12 // Set the value of a specific option property step.options('prop1', true); step.options('prop2', 123); step.options(); // => {prop1: true, prop2: 123}
-
pause()
-
Pauses step execution
- Inherited From:
-
result( [format] [, withDetails])
-
Returns a represention of the result of the test step execution.
Parameters:
Name Type Argument Default Description format
string <optional>
Use a specific hobs.reporters to render the result.
withDetails
boolean <optional>
false By default, hobs.reporters do not process children of successful test steps. Force this parameter to true to also get them.
- Inherited From:
Returns:
An object representing the result of the execution.
- Type
- object
-
resume()
-
Resumes execution of a paused step
- Inherited From:
Throws:
Will throw an error if the step is not paused
-
state()
-
Returns the current state of the step
- Inherited From:
Returns:
- Type
- String