cancel
Showing results for 
Search instead for 
Did you mean: 

Property, which is passed using -P to testrunner, is not available in afterLoadScript

nmrao
Community Hero

Property, which is passed using -P to testrunner, is not available in afterLoadScript

Noticing the following behaviour while testing the options of testrunner (both SoapUI  NG / Open Source Edition).

 

Running a project using testrunner with -P<PropertyNamve>=<Value> option and reading this property in afterLoadScript of the project. It says property value is null which is not possibly expected (In My Opinion), could be a (latent) defect? Can it be confirmed if this understanding is correct? If it is a defect, then it can be addressed.

 

My understanding is that, the property passed to testrunner should be set during the loading of the project and the property made available in afterLoadScript

 

This is all the project is which contians just an assertion in afterLoadScript

 

<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-project activeEnvironment="Default" name="testParams" soapui-version="4.5.1" xmlns:con="http://eviware.com/soapui/config"><con:settings/><con:properties/><con:afterLoadScript>assert project.getPropertyValue('STABILITY_RBD_DATE'), "STABILITY_RBD_DATE Value is empty or null"</con:afterLoadScript><con:wssContainer/><con:sensitiveInformation/></con:soapui-project>

 

09:04:04,416 ERROR [SoapUITestCaseRunner] java.lang.AssertionError: STABILITY_RBD_DATE Value is empty or null. Expression: project.getPropertyValue(STABILITY_RBD_DATE)
09:04:04,416 ERROR [SoapUI] An error occured [STABILITY_RBD_DATE Value is empty or null. Expression: project.getPropertyValue(STABILITY_RBD_DATE)], see error log for detail
java.lang.AssertionError: STABILITY_RBD_DATE Value is empty or null. Expression: project.getPropertyValue(STABILITY_RBD_DATE)
        at org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:388)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.assertFailed(ScriptBytecodeAdapter.java:658)
        at Script1.run(Script1.groovy:1)
        at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
        at com.eviware.soapui.impl.wsdl.WsdlProject.runAfterLoadScript(WsdlProject.java:1511)
        at com.eviware.soapui.impl.wsdl.WsdlProject.afterLoad(WsdlProject.java:565)
        at com.eviware.soapui.impl.wsdl.WsdlProject.loadProject(WsdlProject.java:407)
        at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:244)
        at com.eviware.soapui.impl.wsdl.WsdlProjectFactory.createNew(WsdlProjectFactory.java:41)
        at com.eviware.soapui.impl.wsdl.WsdlProjectFactory.createNew(WsdlProjectFactory.java:24)
        at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:337)
        at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:158)
        at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:89)
        at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:115)


Regards,
Rao.
6 REPLIES 6
TanyaYatskovska
Community Manager

Re: Property, which is passed using -P to testrunner, is not available in afterLoadScript

Hi Rao,

 

Thanks for reporting this.

I've passed this behavior to our R&D Team. Could you please confirm that you see the same issue in Ready! API 1.6?

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
nmrao
Community Hero

Re: Property, which is passed using -P to testrunner, is not available in afterLoadScript

Thank you Tanya for taking it to R&D team.

Not checked on 1.6. However, as mentioned earlier, it appears that it is a latent defect(if this is accepted as defect by R&D), since it is not working SoapUI OS 4.x and Ready API 1.5, so I would expect that very few chances that it could work in 1.6 too.



Regards,
Rao.
JKambli
Staff

Re: Property, which is passed using -P to testrunner, is not available in afterLoadScript

Yes you are right the bug SOAP-3704 is not resolved as yet, but good news is team is working on this issue and should be fixed in upcoming release.

 

Thanks



Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
nmrao
Community Hero

Re: Property, which is passed using -P to testrunner, is not available in afterLoadScript

Thank you for letting know and glad to hear that.

 

Hoping that it will be addressed in both the editons NG & OS



Regards,
Rao.
TanyaYatskovska
Community Manager

Re: Property, which is passed using -P to testrunner, is not available in afterLoadScript

Hi Rao,

 

AfterLoadScript is being fired when loading a project with built-in project settings. The -P argument changes a property only after a project is loaded. I’ve consulted with our Dev Team and they suggest that you add your assertion to project’s Setup Script. The code located there will be executed before loading a project. Please let me know if this solution works for you.

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
nmrao
Community Hero

Re: Property, which is passed using -P to testrunner, is not available in afterLoadScript

Thank you Tanya for following up it with both the ends.

First of all I expressed that it could be a defect, and requested to confirm. Later it is confirmed and a defect is created.

I am confident that there is only afterLoadScript for project and there isn't anything called Setup Script. Or am I missing something?


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors