Forum Discussion
ameesh1984
Contributor
Any simple way to convert this to groovy ?
richie
4 years agoCommunity Hero
Hey ameesh1984,
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
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
- ameesh19844 years agoContributorYes I am not sure about JS to groovy conversion myself
Can anyone help on this ? - richie4 years agoCommunity HeroHey ameesh1984,
I can have a go at it, but im not a real scripter and i might miss something/be unaware of something that would cause it to fail.
I'll give it a shot, perhaps Rao or Himanshu may be able to help?...theyre definitely better placed to help than i.
In the meantime why dont you have a go too...youve been working with some groovy recently...right?
Between us we might be able to get somewhere.
Thats all i got im afraid,
Nice one
Rich - ameesh19844 years agoContributorI am on it , pls start with the collection so that you do have a base to begin with
There was no way I could find to have a nested groovy and JS project in soap ui hence we need to convert this to groovy - richie4 years agoCommunity HeroNp. Working on it right now
Rich - ameesh19844 years agoContributor
Had a q when i try to do this in SOAP UI
The URL in the collection has
https://{{DocumentDBHost}}/dbs/rxc-provider-dev-cdb/colls/provider_pharmacy/docs
I created a project level property for DocumentDBHost with value rxc-provider-dev-us-c-cdb.documents.azure.com:443
When i use this in my TC like below
https://{#Project#DocumentDBHost}/dbs/rxc-provider-dev-cdb/colls/provider_pharmacy/docs
I get a error
- Tue Jun 23 21:54:25 CDT 2020:ERROR:An error occurred [Illegal character in authority at index 8: https://{/#Project%23DocumentDBHost%7D], see error log for details
and Null pointer exception ...
how do i make this work ?
- richie4 years agoCommunity HeroHey ameesh1984,
Are you typing out these URLs or are you copy and pasting?
Reason i ask is you state the following:
"https://{{DocumentDBHost}}/dbs/rxc-provider-dev-cdb/colls/provider_pharmacy/docs
I created a project level property for DocumentDBHost with value rxc-provider-dev-us-c-cdb.documents.azure.com:443"
So are you saying the full URL (host and URI) is as follows?
https://rxc-provider-dev-us-c-cdb.documents.azure.com:443/ dbs/rxc-provider-dev-cdb/colls/provider_pharmacy/docs
That hostname is huge.
Anyway (sorry im getting sidetracked) i believe the error response is giving you the clue where it states " error occurred [Illegal character in authority at index 8: https://{/#Project%23DocumentDBHost%7D] "
You have an erroneous forward slash character ( '/' ) in the hostname. The 3rd slash from the left shouldnt be there. A slash is a reserved character in http as it means something specific. Hence you cant use a / in a hostname.
Also you have an extra ] character (which isnt an http reserved character) but the ] character isnt included in the URI you defined earlier in your post.
Nice one
Rich
Is that right? - ameesh19844 years agoContributorThe url you have is right that's azure cloud and its long
The issue is I have 5.4 soapui so i cannot import the collection else would not have to do this ...manually create each property
If u have and are trying with 5.5 or Pro etc you could just import collection in soap ui - richie4 years agoCommunity HeroYeah i've got ReadyAPI!, but that doesnt help you does it?
I suppose if you send me your collection i could import it and then save it as a new project and send you the project, but i wouldn't have thought the company you work for would allow that...
Rich - ameesh19844 years agoContributorIf you see the collection after import the only parameters are the DocumentHost and master key , you can put your values and change the pre script and make it work, then export it and send me on gmail as they are only json files , that would work
ameesh1984@gmail.com is my gmail - ameesh19844 years agoContributorYou could also put it up on a public github after testing it in your local , same like the original collection and I can take it from there
Related Content
- 4 years agoTommyTester
- 10 months agoMussieG
- 3 years agoMis3
Recent Discussions
- 5 hours agoruchisingh