Forum Discussion

CrazyFrog's avatar
CrazyFrog
Contributor
10 years ago

[Res]execute a single teststep from Intellij

Hello,

I want to execute a single teststep from Intellij but how can i do that.
Execute a specified TestCase is no problem, that work perfectly (http://www.soapui.org/Test-Automation/integrating-with-junit.html).

The problem is: I don't know how to implement the testStep.run command

My code that i use is:



public void fullControl() throws Exception {
WsdlProject project = new WsdlProject("myTestProject-soapui-project.xml");
List<TestSuite> testSuites = project.getTestSuiteList();
for( TestSuite suite : testSuites ) {
System.out.println("Running SoapUI TestSuite [" + suite.getName() + "]");
List<TestCase> testCases = suite.getTestCaseList();
for( TestCase testCase : testCases ) {

//System.out.println("Running SoapUI test [" + testCase.getName() + "]");
//TestRunner runner2 = testCase.run(new PropertiesMap(), false);
//assertEquals(Status.FINISHED, runner2.getStatus());

System.out.println("TestStep count [" + testCase.getTestStepCount() + "]");

for (TestStep testStep : testCase.getTestStepList()) {
System.out.println("TestSteps [" + testStep.getName() + "]");


//public TestStepResult run( TestCaseRunner testRunner, TestCaseRunContext testRunContext );
testStep.run(testRunner, runContext); // <---- to to implement this call
}
}
}
}



Please can anybody help me?

2 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    Try this, Add your testSuite, testCase and testStep name in the code.


    public void testRunner() throws Exception {
    WsdlProjectPro project = new WsdlProjectPro("SoapUIWorkspace/Sample-soapui-project.xml");
    TestSuite testSuite = project.getTestSuiteByName(testSuiteName) ;
    TestCase testCase =testSuite.getTestCaseByName(testCaseName)
    TestStep testStep = testCase.getTestStepByName(stepName)
    TestCaseRunner testCaseRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null)
    TestCaseRunContext testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep)
    testStep.run(testCaseRunner, testStepContext)
    }



    Thanks,
    Jeshtha