Forum Discussion

orion1's avatar
orion1
New Contributor
15 years ago

Problem with GroovyUtils in a Junit / Soapui Test

Hi,

In the first step of my soapui TestCase, i define a fileName using groovyUtils and the context variable:

def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def String fileName = new File(groovyUtils.getProjectPath() + "/properties/myprop.properties");

When I'm running the test directly in soapui (3.6.1), it works fine.

But then if I want to play my soapui test from Eclipse into a junit test, exactlly like in this example:

public void testTestCaseRunner() throws Exception
{
WsdlProject project = new WsdlProject( "src/dist/sample-soapui-project.xml" );
TestSuite testSuite = project.getTestSuiteByName( "Test Suite" );
TestCase testCase = testSuite.getTestCaseByName( "Test Conversions" );

// create empty properties and run synchronously
TestRunner runner = testCase.run( new PropertiesMap(), false );
assertEquals( Status.FINISHED, runner.getStatus() );
}

Then I have an Exception: java.Io.FileNotFoundException [properties/myprop.properties] doesnt exist etc...

If I define the fileName variable without using the groovyUtils.getProjectPath(), then the execution of my junit test works fine.

Any Idea please to help to resolve this?

Thx,
No RepliesBe the first to reply