Forum Discussion

ameesh1984's avatar
5 years ago

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 

39 Replies

  • richie's avatar
    Community Hero

    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 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!


  • nmrao's avatar
    Champion Level 3
    As you pointed rightly, either groovy or java script is supported, but not both.

    If you provide more details, then it may help to see if the same can be achieved in groovy itself.
    • ameesh1984's avatar
      Suppose I need to do the following

      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
      • ameesh1984's avatar
        If I have java code equivalent for the JS pre setup script would that work in groovy test step , then I can leave my project as groovy and add those java pre setup steps in it