Forum Discussion

Thomas_Fuller's avatar
Thomas_Fuller
Occasional Contributor
16 years ago

JUnit integration not working

Hi,

I'm attempting to integrate one of my SoapUI projects with JUnit. I've been through a few of the examples and I'm convinced I'm missing something.

My code is all very closely based on what you've written here (and I've tried several examples):

http://www.soapui.org/userguide/command ... ntegration

For example:

SoapUITestCaseRunner runner = new SoapUITestCaseRunner();

runner.setProjectFile(
    "./test-ws/SecurityServiceProject-soapui-project.xml"
);

runner.run ();

I have several of the test cases in this project working in SoapUI however when I run the suite from the within JUnit the (previously passing) tests fail.

The problem appears to be that not all of my test steps are being called. For example I have a test step that sets a user's detail in the database and then attempts to change it via a web service and then checks the database that it has actually been changed. The step to set the detail in the database is executed when I run the test in SoapUI however it appears to not be executed when I run the same test in JUnit hence the test fails.

Finally, I've even tried this using the test runner as follows:

testrunner.bat SecurityServiceProject-soapui-project.xml

and the results are that it is working fine.

I'm using SoapUI version 3.5.

Any idea what I've missed?

Thanks for your help,

Tom

4 Replies

  • Hi Thomas,

    hmm.. the testrunner.sh script calls the SoapUITestCaseRunner, so there should be no difference.. are you sure you have all the correct libraries in the classpath (and not other versions that collide)?

    regards!

    /Ole
    eviware.com
  • Thomas_Fuller's avatar
    Thomas_Fuller
    Occasional Contributor
    Hi Ole,

    I've isolated my unit test and the only jars I've included are those for SoapUI, JUnit, and JMock (I'll remove the JMock jars but for the moment they're in the project and I don't suspect this is the problem).

    Here are my observations: In one example, the test I have which passes in the SoapUI PRO application is utilising a feature which is only available in the PRO edition (this feature is the datasource). This same test step is not run when I execute the same test in the standard edition SoapUI application (it is essentially ignored), nor does it execute from within JUnit. So I thought the problem is that the license cannot be found when running the test within JUnit. I added the folder that contains my license file and this doesn't seem to help.

    What do you think?

    Thanks for your help,

    Tom
  • Hi Tom,

    If you are using Pro-specific teststeps you will need to use the SoapUIProTestCaseRunner class instead which is in the soapui-pro jar in the bin folder.

    Does that help?

    regards!

    /Ole
    eviware.com