Forum Discussion

maarten's avatar
maarten
Occasional Contributor
13 years ago

Script Assertion works manually, fails executing Testcase

I have a script assertion added to an Assertion Teststep that is working when I run it manually but that fails when executing the Testcase.

The TestCase has:
- 21 Test Requests,
- a 45 minute Delay Teststep and
- 21 Assertion Teststeps using data retrieved from the 21 raw requests of the Test Requests executed earlier

My script assertion only has a call to a script I have in the script Library I created.

company.aProject.aSubProject.aFunction(log, context, messageExchange, anID, anotherID, '15');


When I execute the 21 Script Assertions inside the 21 Assertion Teststeps manually, they all pass.

When I execute the TestCase as a whole, all 21 Assertion Teststeps FAIL and the Message column in the Script Assertion Line of the Assertion Teststep states FAILED - null.

Any idea why it works manually but seems fail executed in the TestCase?

This is the content of the function I call:

def static company.aProject.aSubProject.aFunction(log, context, messageExchange, anID, anotherID, interval)
{
def groovyUtils = new com.eviware.soapui.support.GroovyUtilsPro( context )
def requestHolder = groovyUtils.getXmlHolder( messageExchange.requestContent );
def ID = requestHolder.getNodeValue("//*[local-name()='anID']");
def keystore = messageExchange.request.getSslKeystore();

log.info keystore;
log.info ID ;

..
Lots of code that is not relevant to this issue
..

}

5 Replies

  • Hmm..

    What message do you get in the Test Log when the TestCase fails?
    Do you get any errors in the soapUI or error tabs found in the bottom of the main soapUI window?

    --
    Regards

    Erik
    SmartBear Sweden
  • maarten's avatar
    maarten
    Occasional Contributor
    No errors on error tabs on the bottom of the main soapUI window.

    The Message column (most right column on the Assertion Teststep Window) shows "FAILED - null".

    The Test Case window shows for teh Assertion Teststeps the following: "[Script Assertion] GroovyScriptAssertion FAILED".

    But as I said if I execute the GroovyScriptAssertion manually they all succeed.
  • maarten's avatar
    maarten
    Occasional Contributor
    Sorry didn't really paste the code well there.
    The static method is insode a class and called through that class.
    The same method is actually working when I execute it as a script assertion straight on the Test Request but not when executed as a script assertion on an Assertion Teststep with that same Test Request as source.

    What mail should I send the project files too?