Forum Discussion

larsn's avatar
larsn
Contributor
11 years ago

[Res] testrunner.sh, groovy scripts in scripts dir not found

I'm trying to run tests with soapui pro in a Jenkins setup without the UI, using just testrunner.sh.
I have it installed and licensed but I'm having trouble getting my external groovy script library working.
The tests work fine from my Windows PC - the external groovy code in the scripts directory is automatically compiled, but I can't see in the logs that the testrunner.sh run is trying to compile my scripts. I see that the path to the scripts directory is set.

08:17:28,320 INFO [SoapUIProGroovyScriptEngineFactory] Setting Script Library to [/opt/SoapUI-Pro-4.6.2/bin/scripts]

The error I am getting is:
Script1.groovy: 1: unable to resolve class myscripts.XmlAssertions
@ line 1, column 1.
import myscripts.XmlAssertions

Where are the compiled scripts compiled to? I'm wondering if this is a file/directory permissions problem.

10 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    The source code's not compiled but simply loaded into the Groovy runtime. As long as Jenkins has read access in the Script Library directory you should be fine.

    Regards,
    Manne
  • Hmm. I wonder if the problem is that the licensing is not set correctly - I just setup Pro on Jenkins, installed in a different location than an older version of the open source soapui.

    How can I check that the license is set correctly from testrunner.sh?
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    There is no option in testrunner to check the license directly. Did you start SoapUI Pro on the computer you have Jenkins installed and load the license through the GUI?




    Regards,
    Marcus
    SmartBear Support
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    Then the license should be fine as the error from the first post you entered doesn't look related to a license issue. Please double check that your scripts are setup correctly in the scripts directory.




    Regards,
    Marcus
    SmartBear Support
  • You are correct about soapui being licensed. I looked that the logs again and I have a test case using a data source and the data source is working correctly.

    I've checked the file ownership and permissions for the scripts directory and myscripts subdirectory, and the scripts in those directories and all have jenkins user and group ownership. What else do I need to check for or that I can try?

    I have the scripts working on my PC but not on the Jenkins server.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    How are your scripts setup in directory /opt/SoapUI-Pro-4.6.2/bin/scripts?
    I see you are doing an import myscripts.XmlAssertions in the script you are trying to run. Is there a myscripts directory in /opt/SoapUI-Pro-4.6.2/bin/scripts?



    Regards,
    Marcus
    SmartBear Support
  • > How are your scripts setup in directory /opt/SoapUI-Pro-4.6.2/bin/scripts?

    [root@server scripts]# pwd
    /opt/SoapUI-Pro-4.6.2/bin/scripts

    [root@server scripts]# ls -l
    total 12
    -rw-r--r--. 1 root root 336 Dec 2 10:03 readme.txt
    drwxrwxr-x. 2 jenkins jenkins 4096 Dec 12 15:35 myscripts
    drwxr-xr-x. 4 root root 4096 Dec 2 10:03 soapui

    [root@server scripts]# ls -l myscripts
    total 12
    -rw-rw-r--. 1 jenkins jenkins 7237 Dec 17 15:16 testApiXml.groovy
    -rw-rw-r--. 1 jenkins jenkins 1359 Dec 17 15:16 xmlAssertions.groovy


    > Is there a myscripts directory in /opt/SoapUI-Pro-4.6.2/bin/scripts?
    Yes.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    I don't see any obvious problem other than that, your groovy file is named xmlAssertions.groovy however in your code snippet you are trying to import import myscripts.XmlAssertions. Notice your file name starts with lower case and in code it is in upper case. To my knowledge groovy class names are case sensitive. Try to change it and see if it works.

    Regards,
    Shadid
    SmartBear Sweden.
  • > I don't see any obvious problem other than that, your groovy file is named xmlAssertions.groovy
    > however in your code snippet you are trying to import import myscripts.XmlAssertions.
    > Notice your file name starts with lower case and in code it is in upper case. To my knowledge
    > groovy class names are case sensitive. Try to change it and see if it works.

    Case sensitivity was the issue - that is why the scripts worked on Windows but not Linux.
    Thanks.