Forum Discussion

harmans's avatar
harmans
Occasional Contributor
11 years ago

Invoking TestCase from Eclipse

Hi,

I am trying to invoke a TestCase (in SoapUI ) from Eclipse.

Below is Runner class in Eclipse:

public class Runner {
public static void main(String[] args) throws XmlException, IOException, SoapUIException {
WsdlProject project = new WsdlProject("C:\\Code\\src\\SoapUI\\NewConsumer-soapui-project.xml");

TestSuite suite = project.getTestSuiteByName("NewConsumer");
TestCase test = suite.getTestCaseByName("Login");

PropertiesMap map = new PropertiesMap();
map.put("email","q092413@qa.com");
map.put("merchantid","merch123");

TestCaseRunner runner = test.run(map,false);
System.out.println("Context" + runner.getRunContext());
System.out.println(runner.getStatus());
System.out.println("***********************");
}
}

and below is my TestStep request in SoapUI (In Suite 'NewConsumer', TestCase 'Login')

{
"jsonrpc": "2.0",
"id": "1",
"method": "Customer.Authorize",
"params": {
"headers": {
"apiVersion": "1.2",
"realm": [
,
"appVersion": "1.3.9",
"deviceOS": "Android 4.0.4",
"deviceModel": "samsung : SPH-D710"
},
"email":${email},
"MerchantId":${merchantid}
}
}

Log (in eclipse)
14:32:13,849 WARN [SoapUI] Missing folder [C:\Code\src\EclipseSoapDDF\NewConsumer\NewConsumer\.\ext] for external libraries
14:32:14,453 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\Harman\soapui-settings.xml]
14:32:15,802 INFO [WsdlProject] Loaded project from [file:/C:/Code/src/SoapUI/NewConsumer-soapui-project.xml]
14:32:16,934 DEBUG [HttpClientSupport$SoapUIHttpClient] Attempt 1 to execute request
14:32:16,934 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Sending request: POST /DataProvider/Login HTTP/1.1
14:32:17,091 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Receiving response: HTTP/1.1 200 OK
14:32:17,109 DEBUG [HttpClientSupport$SoapUIHttpClient] Connection can be kept alive indefinitely
Context{}
FINISHED

On executing Runner class from eclipse, TestCase 'Login' never gets invoked. Can someone please help ?

4 Replies

  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    Hi, what soapui version are you using? have you tried with other soapui versions?
    could you confirm you don't have any issue when running the test in the soapui application (which version)?
    Thanks
  • harmans's avatar
    harmans
    Occasional Contributor
    I am testing with SoapUI Pro 4.6, jre 1.7, eclipse 4.2

    I have not tried other versions of SoapUI and there are no issues running the testcase from within SoapUI.
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    ok thanks,
    how did you manage soapui dependencies in your eclipse project (copy all lib by hand, maven, ....)? you could have some missing dependencies
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hmm... I guess you have verified that you have spelled the names correctly.
    What if you try to run everything like this:

    import com.eviware.soapui.model.project.ProjectFactoryRegistry;
    import com.eviware.soapui.SoapUIProTestCaseRunner;

    SoapUIProTestCaseRunner runner = new SoapUIProTestCaseRunner();
    ProjectFactoryRegistry.registrerProjectFactory( WsdlProjectFactory.WSDL_TYPE, new WsdlProjectProFactory() );
    runner.setProjectFile(<PATH TO PROJECT FILE> );
    runner.run();