cancel
Showing results for 
Search instead for 
Did you mean: 

Structuring Groovy

Community Leader

Structuring Groovy

Hello Members,

 

Is there any way in ReadyApi or any other tool out there where i can structure my unstructured Groovy Code in Groovy Script or Script assertion


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
3 REPLIES 3
Contributor

Re: Structuring Groovy

Hi there,

 

By structure do you mean format/beautify (auto indentation)

This is possible with xml forms using the shortcut Alt + f

 

 

As for structuring Groovy, you can use external editors such as sublimetext3 which can open your entire project filesystem, or you can copy and paste your scripts into here to be formatted

 

To add the formatting functionality click preferences -> key bindings

key bindings.png

Then in the keymap.User window (should be the blank window on the right) copy and paste this

 

[
	{"keys": ["alt+shift+f"], "command": "reindent", "args": {"single_line": false}}
]

 

 

This allows you to format with the shortcut Alt + Shift + f. One thing to note: When you copy and paste your groovy code over make sure you click view -> syntax -> groovy.

 

Example:

 

before.pngBefore

after.pngAfter

 Hope this helped,

Mo

 

If my answer helped you out, please consider leaving kudos and/or accepting as a solution.
Have an awesome day!
Community Leader

Re: Structuring Groovy

And i hope it won't send any information or code anywhere wlse online.

 

Coz by using this i want to format my companies code and it won't be allowed to use these open-source softwares to be installed on local machine.

 

Thanks,

Himanshu Tayal


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
Contributor

Re: Structuring Groovy

It is an offline text editing program, similar to notepad - check with your admin team if they can install it for you.

 

But to answer your original question, no I don't think ReadyAPI or SoapUI have any built in groovy formatter, I'm sure you could suggest it as a new feature

 

All the best,

Mo

 

EDIT: I see you already have here haha, best of luck with that Smiley Happy

 

 

If my answer helped you out, please consider leaving kudos and/or accepting as a solution.
Have an awesome day!
New Here?
Join us and watch the welcome video:
API Testing Mistake #2
APITestingMistake#2