Forum Discussion

ibekacyril's avatar
ibekacyril
Occasional Visitor
6 years ago
Solved

Create array of JSON objects using groovy in soapui

I am trying to create an array of JSON objects when I run my script. So I decided to store the errors or no error for each assertion created within each teststep. Each of the test steps are then st...
  • JHunt's avatar
    JHunt
    6 years ago

     

     

    This bit:

    for(assertion in r.testStep.assertionList ) {
        assertList = new ArrayList<String>();
        errorList = new ArrayList<String>();
        for(e in assertion.errors) {
            errorList.add(new ErrorClass(message: e.message))
        }
        assertList.add(new AssertClass(assertionName: assertion.label, assertionStatus: assertion.status, message: errorList));
    }

    should be like this:

    assertList = new ArrayList<String>();
    for(assertion in r.testStep.assertionList ) { 
    errorList = new ArrayList<String>();
    for(e in assertion.errors) {
    errorList.add(new ErrorClass(message: e.message))
    }
    assertList.add(new AssertClass(assertionName: assertion.label, assertionStatus: assertion.status, message: errorList));
    }