This is my code:
===============
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
try
{
def httpResponseHeaders = context.testCase.testSteps["Login"].testRequest.response.responseHeaders
def ActualStatus = httpResponseHeaders["#status#"]
def expectedHTTPResponse = ['HTTP/1.1 200 OK']
assert expectedHTTPResponse == ActualStatus //validate status here
log.info("Testcase is Passed")
}
catch(AssertionError e)
{
log.info("Testcase is Failed")
}
If I run the groovy script individually, its show the correct result for valid data(Actual Status=ExpectedStatus).Now, when I run the testcase[login and groovy script, 2 steps], it will show the correct result as "Pass". I am using assert to validate the status. Again when I am passing invalid data(Actual Status!=ExpectedStatus) and running the groovy script individually, it will show the result as "Testcase is failed". And when I run the test case [login and groovy script, 2 steps], it will show the correct result as "Pass". Actually, it is suppose to fail.
How to handle assert to validate the status?