Forum Discussion

kadir's avatar
kadir
Occasional Contributor
2 months ago

using groovy script in readyapi

I have maven project for my readyapi, have java and groovy script in it, and placed jar into C:\Program Files\SmartBear\ReadyAPI-3.51.0\lib my groovy script directory is in src/main/groovy directory. So I am able to use java classes but when I try to use groovy script in readyapi step it doesn't work, not able to find groovy class.

I can add my groovy script to C:\Program Files\SmartBear\ReadyAPI-3.51.0\bin\scripts and that works as expected, but how can I use groovy script in my maven project from jar file I added it to C:\Program Files\SmartBear\ReadyAPI-3.51.0\lib ?

Here is the groovy script I use in my readyapi to call groovy script in maven project:

import src.main.groovy.Utilities

def utilities = new Utilities(context, context.testCase.testSuite, log)

utilities.loadConfigurations()

Thanks in advance,

6 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    kadir 

    Looks the package in the import statement is incorrect.

    I believe the below is your maven directory structure, not the actual package. Isn't it?

    src.main.groovy

    May be you try remove the above from import statement and see. 

    You may try to open the jar file and show the picture if the above suggest doesn't help.

     

  • kadir's avatar
    kadir
    Occasional Contributor

    I tried that, when I have the following it gives error that can't find the Utilities

    import Utilities

    def utilities = new Utilities(context, context.testCase.testSuite, log)

    utilities.loadConfigurations()

    • nmrao's avatar
      nmrao
      Champion Level 3

      I suggested other option about shaing the picture of the jar opened?

      or 

      from command line execute below command and show the output.

      jar -tvf <jar file path>

      Or show picture of your Utilities groovy?

  • kadir's avatar
    kadir
    Occasional Contributor

    sorry I thought I shared that, here is the pic of where Utilities.groovy located

     

  • nmrao's avatar
    nmrao
    Champion Level 3

    Thanks for that. Certainly, there isn't any package.

    Now question is what is in Utilities.groovy. Is it a class? or script?

  • nmrao's avatar
    nmrao
    Champion Level 3

    kadir

    Did you get chance to look at above and reply if you still persist the issue?