Forum Discussion

Felder71's avatar
Felder71
Occasional Contributor
9 years ago

SoapUI Pro to SoapUI NG migration - afterLoadScript vs. beforeRunScript

We are in the process of upgrading from SoapUI Pro 5.1.2 to SoapUI NG Pro (Ready! API 1.4.1) and have come upon a key difference in how the project setup scripts work.

 

In SoapUIPro, the setup script for the Project was saved as an "afterLoadScript". This means that the script was run only after the project was loaded. However, in SoapUI NG Pro, the setup scripts entered for the project are saved as a "beforeRunScript". That means that the script is run each and every time before you run the project and not when the project is loaded.

 

This has created a few issues for us.

 

One, when opening the projects originally in SoapUI NG, the setup script appeared to be missing. It did not appear in the UI. When we added it again, we could see it but now it is in the project XML twice, once as an afterLoadScript and once as a beforeRunScript. So if we want to keep it as an afterLoadScript, we have to manually edit the XML since this script tag does not appear in the UI, that I have found.

 

Two, beforeRunScripts are causing issues with our implementation with the Maven plugin. We currently have SoapUI properties in the POM files for Maven that will overlay on each project after loading. This works properly using the afterLoadScript property, because the script loads the default properties and then Maven overwrites the specific environmental ones as necessary. However, this does not work with the beforeRunScript property, because the Maven will overwrite the specific properties and then the load script gets run again right before execution, meaning the necessary properties have been changed.

 

Is there any way to continue to use afterLoadScripts within the UI or are we now going to be forced to manage them within the XML directly? Or will there be an update to the Ready API plugin to put the properties into place after the beforeRunScript has been executed?

 

Thanks,

Adam

 

  • It looks, there is some confusion, could be because of UI changes?

     

    Just tried in ReadyAPI 1.4.1 and I can see load script, then whatever you code there, it appears inside of afterLoadScript element of xml after saving the project. This looks normal and did not face the issue mentioned by you.

     

    Please see if you followed the same as shown in the screen shot.Selection_256.png

  • nmrao's avatar
    nmrao
    Champion Level 3

    It looks, there is some confusion, could be because of UI changes?

     

    Just tried in ReadyAPI 1.4.1 and I can see load script, then whatever you code there, it appears inside of afterLoadScript element of xml after saving the project. This looks normal and did not face the issue mentioned by you.

     

    Please see if you followed the same as shown in the screen shot.Selection_256.png

    • Felder71's avatar
      Felder71
      Occasional Contributor

      Thank you, nmrao. I see where everything is now. I appreciate your help.

       

      Adam

      • nmrao's avatar
        nmrao
        Champion Level 3
        You are so quick to verify things out. Glad to know, happy testing :)
  • nmrao's avatar
    nmrao
    Champion Level 3
    It is still possible to use afterLoadScript by editing the project xml, but not possible from readyapi tool. Is it correct?
    • Felder71's avatar
      Felder71
      Occasional Contributor

      Correct, you have to go in and manually edit it. Additionally, when testing from the UI, you used to be able to rerun the script by going to the Setup script and pressing the Play button. Since the afterLoadScript doesn't appear there any more, you actually have to reload the project itself, which is an annoyance.

      • nmrao's avatar
        nmrao
        Champion Level 3

        What you are seeing not really for the project level, thats for the suite level. You may hover your mouse on Setup Script tab which will show the description.