Forum Discussion

gsarno's avatar
gsarno
New Contributor
14 years ago

Passing properties between SOAPUI and JUNIT.

Hello,
I am trying to pass properties between Junit and SOAPUI (in both directions) with little success. I wrote the follwing code in JUNIT to try to modify the TestStep Properties: ( NOTE: I also have a SOAPUI TestCase with a testStep called "Properties)

WsdlProject project = new WsdlProject("soapui-project.xml");
com.eviware.soapui.model.testsuite.TestSuite testSuite = project.getTestSuiteByName( "TestSuite1" );
com.eviware.soapui.model.testsuite.TestCase testCase = testSuite.getTestCaseByName( "TestCase1" );
TestStep ts = testCase.getTestStepByName("Properties");
ts.setPropertyValue("Prop", "whatever"); // Set the property Prop.
// create empty properties and run synchronously
com.eviware.soapui.model.testsuite.TestRunner runner = testCase.run( new PropertiesMap(), false );
TestStep ts2 = testCase.getTestStepByName("Properties");
String outProp=ts2.getPropertyValue("Prop")
.................

I also tried to directly access to the properties via the testcase (String prop=testCase.getPropertyValue("Prop"); ) but with no success.

How is it possible to pass properties from Junit testcase to SOAPUI and vice versa ?

Thanks.

1 Reply

  • goutham777's avatar
    goutham777
    Occasional Contributor
    Hi ,

    SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
    String a[] ={"email=xxx","password=yyy"};
    runner.setProjectProperties(a);

    Where email and password are properties

    you can also do the same using
    WsdlProject project = new WsdlProject( "pat to ur xml " );
    project.setPropertyValue("email", "xxxx");

    Thanks,
    Goutham