Hi,
Here my class:
package soapui.testStep;
import java.util.List;
import com.eviware.soapui.model.testsuite.TestRunContext;
import com.eviware.soapui.model.testsuite.TestRunListener;
import com.eviware.soapui.model.testsuite.TestRunner;
import com.eviware.soapui.model.testsuite.TestStepResult;
import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus;
public class TestStepListener implements TestRunListener {
public void beforeRun(TestRunner testRunner, TestRunContext runContext) { }
public void afterRun(TestRunner testRunner, TestRunContext runContext) { }
public void beforeStep(TestRunner testRunner, TestRunContext runContext) { }
public void afterStep(TestRunner testRunner, TestRunContext runContext, TestStepResult result) {
if (result.getStatus()==TestStepStatus.FAILED) {
// List sides = (List) runContext.getProperty("sides");
String senderSideStatus, receiverSideStatus;
// senderSideStatus = (String) runContext.getProperty("expected" + (String) sides.get(0) + "ModelStatus");
// receiverSideStatus = (String) runContext.getProperty("expected" + (String) sides.get(1) + "ModelStatus");
senderSideStatus = (String) runContext.getProperty("expected" + (String) runContext.getProperty("side0") + "ModelStatus");
receiverSideStatus = (String) runContext.getProperty("expected" + (String) runContext.getProperty("side1") + "ModelStatus");
if (runContext.getCurrentStep().getName().equals("receiveRequest") && (senderSideStatus.equals("Failed") || (senderSideStatus.equals("Started") && receiverSideStatus.equals("Failed")))) {
// Test must fail so it is OK
} else {
runContext.setProperty("testFailed", true);
runContext.setProperty("testStepName", runContext.getCurrentStep().getName());
runContext.setProperty("testStepErrors", testRunner.getResults().get(runContext.getCurrentStepIndex()).getMessages());
}
testRunner.gotoStepByName("Loop to next properties file");
}
}
}
I hope this will help you to help me