Forum Discussion

MistaWizard's avatar
MistaWizard
Occasional Contributor
9 years ago

how do you access content of an assertion test step within groovy

how do I get/access the content of an assertion test step within groovyscript?

I have the line  

			def ass = it.getAssertions()

This gives me the container

Wed Jun 17 13:51:39 CAT 2015:INFO:assertion: [Contains:com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.SimpleContainsAssertion@9167631]

I've looked at the apidocs, not succesfully at all. From what i know I can't use the messageExchange methods because this is going to sit in the teardown script. I can't even find getAssertions :(

3 Replies

  • MistaWizard's avatar
    MistaWizard
    Occasional Contributor

    this is the best i could do - if anyone could give me a way to not list through (i know its better this way below for a few reasons)

                def ass = ""
                def assList = testRunner.getTestCase().getTestStepByName("${it.name}").getAssertionList()
                for(x in assList)
                   {ass = x.getToken().toString()}

     

    • tech321's avatar
      tech321
      Contributor

      .getToken() does not work - her is what I get

      groovy.lang.MissingMethodException: No signature of method: Script30.getToken() is applicable for argument types: () values: [] Possible solutions: getClass() error at line: 79.

       

      Any idea what else to use to retreive the content of the assertion?