Forum Discussion

nmrao's avatar
nmrao
Champion Level 3
9 years ago

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)
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    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?

    • nmrao's avatar
      nmrao
      Champion Level 3

      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.

      • JKambli's avatar
        JKambli
        Staff

        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