Forum Discussion

SKoneru's avatar
SKoneru
Contributor
12 years ago

test fails via tool, works via maven soapui-pro plugin

Hi,

I had created some maven based java projects and set dependency on some jar files hosted in the local nexus repo that is maintained by my company.
These dependencies pull in lots of other jar files.
I noticed lots of jars in .m2/repository folder.

Now I did refer to a java class in groovy script test step.
The question is how to run the tests. There are two ways via command line and with tool.

1- when I invoke the SOAPUI test project via maven soapui-pro plugin then the script works fine. It could identify the java class. So no issues executing command line.
2- But the groovy script fails when I execute the tests in SOAPUI-PRO tool as I didn't include the jars in bin\ext. The main reason I didn't set the jars in bin\ext is I don't know what all jars are required. In #1 case Maven did retrieve all the jars.

Is there a way in SOAPUI-PRO to extend the classpath and fetch all the jars in maven repo(.m2/repository)? can we do that? Is this a good idea? What is the best approach?
  • Both are different.
    The question in this forum post is how to set classpath to maven repo so that the test can run from SOAPUI-PRO tool.
    Currently the test can run via maven soapui-pro plugin but not from tool as the jars are available in the repo.
    There are lots of jar files that maven stores in repo. I can not set all the jars in bin\ext.

    The other forum post(viewtopic.php?f=2&t=21022) is related to exception. The tests fail from the maven soapui-pro plugin also due to the exception.
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    Hi,
    it is possible to configure the directory where soapui looks for external jars.
    It is defined by the "soapui.ext.libraries" system property, you can modify it in the soapui startup script and also in the command line tools scripts.

    Jars must be stored directly at the root of this directory which means that this won't work with the maven repository layout.
    I also don't think this is a good idea to have all jars taken from your maven repository added to the soapui repository. This could lead classpath conflicts without letting you know where the issue come from.


    You could maybe try the following.
    The idea is to be able to put in a given directory all jars that your custom code depends on. As your custom projects are built with maven, let's maven do it.
    Create a maven project and make it depends on all the projects you want to be added to soapui.
    Use the maven depency plugin to copy these dependencies to a given directory.
    Configure soapui to use the directory as ext folder.

    What do you think about this?
  • Thank you for your valuable suggestions.
    I can certainly try that. But I will for sure end up with concerns that you stated related to classpath conflicts.

    >>It is defined by the "soapui.ext.libraries" system property, you can modify it in the soapui startup script and also in the command line tools scripts.
    I am relying on SOAPUI- extension plugin "https://github.com/redfish4ktc/maven-soapui-extension-plugin/wiki/Tips". Can I configure as described in "avoid log warnings at startup" section.
    Where can I find the start up script or what is the command line option that I can specify for "soapui.ext.libraries" system property?
  • Hi SKoneru,

    As you have figured out, you will need the jars in bin/ext/ for you to be able to run your project. My suggestion is that you try to figure out which jars you need, for instance by running mvn dependency:tree to see the tree of all your dependencies. redfish4ktc2's suggestion is definitely worth a try if you are unable to do this.

    What is the exception you're getting when trying to run the tests inside SoapUI?

    Regards,
    Arian
    SmartBear Sweden
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    SKoneru the startup script I am talking about is the soapui.bat/sh file in the bin directory of your soapui gui installation directory.
    The "soapui.ext.libraries" system property is already set in this file, you only have to modify it if needed