title: compare line by line failed teststep response to a teststep "assertion contains" using groovy script soapui
body: <p>I've been searching for a way to compare the response of a failed test step to the "contains" assertion of that test step, and spit out just the differences into a log file called that teststep. Sounded so easy :(
  <p> In other words, I need a groovy script that's going to sit at the end of the test case and run through all failed test steps inside that testcase then compares each line in the response to its corresponding line in the test step assertion contains(its called Contains Assertion  which is literally a copy paste of a previous valid and working response) and then we need to spit out the line(s) that are different into a log/file. Here's what I have so far (rad, i fixed the previous error)</p>
  
  <pre><code>import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus
  
  def TestCase = testRunner.getTestCase()
  def StepList = TestCase.getTestStepList()
  
  StepList.each
  {
      if(it.metaClass.hasProperty(it,'assertionStatus'))
      {
          if(it.assertionStatus == AssertionStatus.FAILED)
          {
              def ass = it.getAssertableContentAsXml()
              def res = it.getTestStep().getPropertyValue('Response')
              log.error "Test Step: ${it.name} " + "${it.assertionStatus}"
              log.info ass 
              log.info res
          }
      }
  }
  </code></pre>