Cannot set Project Script Library for composite projects
Hello,
I had a look at this case but the resolution is not applicable.
First I had a project in single-file format stored under "C:\ReadyAPI\flowTester\flowTester-project.xml"
The project property "Script Library" contains "${projectDir}\scripts" which translates into "C:\ReadyAPI\flowTester\scripts".
The "C:\ReadyAPI\flowTester\scripts" directory contains the groovy code used by the project groovy test steps.
Everything was nice.
I could give my colleagues the content of "C:\ReadyAPI\flowTester\" and they were happy.
Now, we want to take advantage of Git and ReadyAPI transformed the project into a composite one.
The composite project (directory) path is then "C:\ReadyAPI\flowTester\flowTester-project"
The things stored in Git should contain everything needed for the project to run.
Hence, I would need to move the "script" directory under the "C:\ReadyAPI\flowTester\flowTester-project\" containing the composite files.
The problem is that "${projectDir}\scripts" translates into "C:\ReadyAPI\flowTester\scripts" and not "C:\ReadyAPI\flowTester\flowTester-project\scripts".
I tried setting "Script Library" to ${=context.testCase.getTestSuite().getProject().getPath() + '\\scripts'}
The problem is that context.testCase does not exists and the ReadyAPI log shows:
Tue Jan 24 13:45:10 CET 2023: ERROR: Error evaluating script
java.lang.NullPointerException: Cannot invoke method getTestSuite() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:44)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:34)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
at Script4.run(Script4.groovy:1)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.runAndGetResult(SoapUIGroovyScriptEngine.java:111)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:97)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:98)
at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.doEval(EvalPropertyResolver.java:161)
at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.resolveProperty(EvalPropertyResolver.java:149)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:213)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:156)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:152)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:148)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:257)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expandProperties(PropertyExpander.java:261)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProProjectGroovyClassLoader.getScriptsFolder(SoapUIProGroovyScriptEngineFactory.java:154)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyClassLoader.syncExternalClasses(SoapUIGroovyClassLoader.java:80)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyClassLoader.run(SoapUIGroovyClassLoader.java:67)
at java.base/java.lang.Thread.run(Thread.java:833)
So... How can I get the project FULL path to use it to set the the Script Library for Composite Projects ?
Thank you in advance,
Pierre