Forum Discussion

Raju_Vusirikala's avatar
Raju_Vusirikala
Contributor
16 years ago

Can we catch failures?

Hi Ole,

Is there any facility to catch Test failures such as assertion failure or Test Case Failure. If so could please let me know the Failure catch mechanizm.

Thanks
Raju.

2 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Raju,

    From where / how do you want to catch them? Can you elaborate on what you want to do?

    regards!

    /Ole
    eviware.com
  • Hi Ole,

    In our scenario - we have two test steps 1. SoapTestRequest 2. Groovy Script.

    In Groovy script we have following code snippets

    //Begin of code snippet

    try{
    def CCWSProcessor ccWSProcessorObj = new CCWSProcessor(context, testRunner, CCAPICommand.CCGetCustomer,"CCGetCustomerRequest");

    assert ccWSProcessorObj.isValid();
    assert ccWSProcessorObj.isStatusOk();

    def expectedResult = ccWSProcessorObj.getExpectedResultDO();
    def actualResult = ccWSProcessorObj.getActualResultDO();

    assert (expectedResult == actualResult)
    }catch(Exception exp){
    testRunner.fail "Exception : "+exp.getMessage();
    }
    //End of Code Snippets

    Here when ever assert statement fails - In the reports it is providing information about this particular asser failure.

    In case of Test Case failures - we would like to have
    submitted testRequest  and received testResponse for step 1 in Test reports in the report itself. 

    Currently we are logging the request and response in the log file but it is very tedious job - to corelate the failed issue with respective submitted information from logs and test Results.

    Thanks
    Raju.