Groovy and Java scripts in one project
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Groovy and Java scripts in one project
I have a project need where i need to perform some REST calls in a groovy project but then in the same project need to call some REST API's which has some java script in it for pre setup ....can they both be in the same project as per soap ui documentation we can have only one language in the project properties with the script language set to groovy or Javascript ?
So this would be like a nested project where i need both groovy and Javascript to work in the same project
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Id welcome an answer to this too!
As @ameesh1984 states, the help info appears to indicate the use of groovy or javascript is mutually exclusive at project level.....it doesnt appear that you can run both script command interpeters in the same project.
HOWEVER, this appears to contradict the instructions defined for OAuth v2.0 automatic token retrieval (javascript) along with checking if the OAuth 2.0 token has expired or not (groovyscript).
Also, if you think about it, the help indicates you cant run both at the same time but if you need OAuth v2.0 in your project so you need to use javascript for auto token retrieval, doesnt this mean that you cant have ANY other groovyscript in your project? Surely thats madness!?!?!?! Very few of my projects now dont use at least some groovy snippets.
Would welcome any guidance on this please!
Cheers,
Rich
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you provide more details, then it may help to see if the same can be achieved in groovy itself.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. My pre setup script has some JS code that needs to run and do some initial setup
2. My actual project is Rest based and has some assertions via groovy asserts
Can this be done in one project how would I do this ?
Here is some of the JS code in this postman collection in the pre setup script
https://github.com/liupeirong/cosmosdb-postman-collection
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Attached it
It basically takes postman variables like host , keys etc and does some stripping or modfications to it
It was basically meant for pre setup before the test
I am looking to convert this to groovy so that it will work in my existing soap ui project
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any simple way to convert this to groovy ?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had a search for this about 2 years ago and couldnt find anything. I just searched and it appears there may be a couple of js to groovy converters but i doubt you can just paste the js code in, hit convert and out comes some spffy groovy code that works right away.
I had a quick look at the js and it doesnt look that complicated (well...i could read it, which should tell you how basic it appears).
If i were you id try and identify what is going on (e.g. "vars attribute" is defining new variable in js, which is like "def attribute" in groovy) and then search for the groovy equivalent.
Im even tempted to have a go at this myself, but i dont want you to rely on me cos my coding bites, so i suggest having a to yourself unless one of the scripters has js AND groovy
Ta
Rich
Ta
Rich
