Forum Discussion
11 Replies
- nmraoChampion Level 3I believe so though did not have much details in the documentation
https://www.soapui.org/soap-mocking/deploying-mock-services-as-war-files.html
What you can do is generate war and see web.xml where it shows place holder for scripts.
By the way, interesting to see your use case. If possible, please elaborate.- LavalyteOccasional Contributor
I know you can put groovy scripts in to be called at various points, but what I would like to be able to do is write some overarching code so I can do things like keep an object in memory across multiple web method calls.
In my use case I have have several web methods that build up a request into an external system. I want to be able to store objects in memory to represent these requests, and would rather have code external to the web method hooks to represent the structure and storage of the requests.
For example, I would like to instantiate the map that stores the requests here, and just let the scripts look up the map to get the request to work with it.
Further, this would be the cleanest place if I want to instantiate globally available stuff like lists of mock customer names or street names or similar and don't want to push that stuff into a database table.
- rupert_andersonValued Contributor
Hi,
Please see if my answer to your other post helps:
Using a custom Groovy lib jar works OK as a means to centralise and reuse scripts across SoapUI.
Regards,
Rupert
- KarelHusaChampion Level 2
I would suggest to try the following -- choose one of the mock services and utilize it's start script. The script can do the setup for all mock services included within WAR. The start script is executed when a mock service is started, so should be executed just once as you need.
I use dynamic mock services with Groovy scripts deployed as WAR, but not the start scripts in particular.
I am not aware of another of-the-shelf functionality you could use. If this won't work, you will probably need to customize the WAR.
Karel
- LavalyteOccasional Contributor
Yeah, that was my fallback.
It's a shame because I would love to have somewhere I could dump all the class definition code I'm going to have to write and keep the scriptlets relatively clean.
- LavalyteOccasional Contributor
I think this is a difference between open source and NG Pro.
Related Content
- 8 years ago
- 11 years ago
- 4 years ago
Recent Discussions
- 2 days ago