Forum Discussion

diva-e-api-test's avatar
diva-e-api-test
New Contributor
8 years ago
Solved

Is ist possible to see why an assertion test step fails?

I have an assertion test step which fails and I have no idea why it does. It would be very helpful to have the same information as in a REST-request test step where it is possible to add an assert. If I run the test step and the assertion fails, I get information like"Comparison failed. Path: [$['variable'][0]['code']]; Expected value: [xyz; Actual value: [xxy]. "

2 Replies

  • Radford's avatar
    Radford
    Super Contributor

    To me that doesn't seem right, perhaps it might be best to raise a support call to see if this is expected behaviour or not.

     

    As a work around you can try adding the following to your test case teardown script:

     

    testRunner.getResults().each() { result ->
    	if(result.getStatus().toString() != 'OK' ){
    		log.error('TestStep "' + result.getTestStep().getName() + '" finished with the status ' + result.getStatus().toString())		
    
    		result.getMessages().each() { message ->
    			log.error('Error message: ' + message) 
    		}
    	}
    }

     

    It loops through all of the test steps in your test case and prints error messages for failed steps.