pembertonrw
12 years agoContributor
[Resolved] Failing Script Assertion Step on Test Step
I have a script assertion step that asserts a load of values that are returned in a response to a request. Currently I am passing in a map with three properties:
* Property Name
* ActualResult
* ExpectedResult
Most of the values that are returned are randomly generated by the test so what I want to do is to fail the test step with a prettier error. I have tried
which works OK but will only fail properly if the test case is ran but not when the test step is being ran manually.
So what I would like to do is just cause the script assert to fail with the more prettier error.
* Property Name
* ActualResult
* ExpectedResult
Most of the values that are returned are randomly generated by the test so what I want to do is to fail the test step with a prettier error. I have tried
resultsToCheckMap.each()
{
try
{
assert it.get('ExpectedResult') == it.get('ActualResult')
}
catch(AssertionError e)
{
context.testRunner.fail("Actual result did not match expected result for Property: " + it.get('PropertyName') + "Actual: " + it.get('ActualResult') + "ExpectedResult: " + it.get('ExpectedResult'))
}
}
which works OK but will only fail properly if the test case is ran but not when the test step is being ran manually.
So what I would like to do is just cause the script assert to fail with the more prettier error.