Forum Discussion

Oberfinanzdirek's avatar
Oberfinanzdirek
New Contributor
13 years ago

How to run a soapUI composite project in a Maven build?

Hi,

the question has been asked before on this forum but I have not been able to find a working solution so once again:

We have recently switched a "normal" soapUI project to a composite project. Before that we were executing the tests from that project in our CI (Maven) builds using the maven-soapui-plugin.
Now I am lost as to how to run the composite project from within maven. I did find an answer advising to run the testrunner.sh as "freestyle" CI project, unfortunately, this is not an option for us; our build sets up and tears down the test environment using maven plugins so we need to execute the tests from within the maven build lifecycle.

Is there a way to run all tests from a composite project using the maven-soapui-plugin/maven-soapui-pro-plugin, if so, how would I need to configure the plugin?
If not, is there an alternative (maybe running the soapUI testrunner.sh from maven-exec-plugin or as a junit test?) and could you give me some pointers how to configure this?
If a soapUI installation is required on the CI server, would we need an extra license to run composite projects on our CI Server?

Regards

Daniel

9 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Daniel,

    you should be able to just use the pro version of the plugin and specify the root folder of the composite project as the path - have you tried that?

    regards,

    /Ole
    SmartBear Sweden
  • Hi Ole,

    thanks for the fast reply.

    Yes, I have - I tried to set the directory as "projectFile" (see below), not sure whether that was the right place though:
    ("GDAServices-soapui-project" is the name of the soapUI project's directory)


    [...]
    <plugin>
    <groupId>eviware</groupId>
    <artifactId>maven-soapui-pro-plugin</artifactId>
    <version>4.0.0</version>
    <executions>
    <execution>
    <id>run-tests</id>
    <phase>integration-test</phase>
    <goals>
    <goal>test</goal>
    </goals>
    </execution>
    </executions>
    <configuration>
    <printReport>false</printReport>
    <projectFile>${basedir}/src/test/soapui/GDAServices-soapui-project</projectFile>
    <outputFolder>${basedir}/target/soapui</outputFolder>
    <junitReport>true</junitReport>
    <exportAll>true</exportAll>
    <soapuiProperties>
    <property>
    <name>soapui.logroot</name>
    <value>${project.build.directory}/soapui-logs/</value>
    </property>
    </soapuiProperties>
    </configuration>
    </plugin>
    [...]


    This causes an exception to be thrown during the build:


    Error at line 1, column 1
    org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1276)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1263)
    at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
    at com.eviware.soapui.config.SoapuiProjectDocumentConfig$Factory.parse(Unknown Source)
    at com.eviware.soapui.impl.wsdl.WsdlProject.loadProject(WsdlProject.java:314)
    at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:234)
    at com.eviware.soapui.impl.wsdl.WsdlProjectFactory.createNew(WsdlProjectFactory.java:41)
    at com.eviware.soapui.impl.wsdl.WsdlProjectFactory.createNew(WsdlProjectFactory.java:24)
    at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:319)
    at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:151)
    at com.eviware.soapui.maven2.TestMojo.execute(TestMojo.java:122)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    Caused by: org.xml.sax.SAXParseException: Unexpected element: CDATA
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038)
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454)
    ... 30 more
    com.eviware.soapui.support.SoapUIException: Failed to load project from file [file:/D:/LzfD-IDE/src/gda/trunk/system-test/src/test/soapui/GDAServices-soapui-project/]
    at com.eviware.soapui.impl.wsdl.WsdlProject.loadProject(WsdlProject.java:404)
    at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:234)
    at com.eviware.soapui.impl.wsdl.WsdlProjectFactory.createNew(WsdlProjectFactory.java:41)
    at com.eviware.soapui.impl.wsdl.WsdlProjectFactory.createNew(WsdlProjectFactory.java:24)
    at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:319)
    at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:151)
    at com.eviware.soapui.maven2.TestMojo.execute(TestMojo.java:122)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    Caused by: org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1276)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1263)
    at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
    at com.eviware.soapui.config.SoapuiProjectDocumentConfig$Factory.parse(Unknown Source)
    at com.eviware.soapui.impl.wsdl.WsdlProject.loadProject(WsdlProject.java:314)
    ... 25 more
    Caused by: org.xml.sax.SAXParseException: Unexpected element: CDATA
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038)
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454)
    ... 30 more

    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] : com.eviware.soapui.maven2.TestMojo@1bb51fd
    SoapUI Test(s) failed

    Failed to load soapUI project file [D:\LzfD-IDE\src\gda\trunk\system-test/src/test/soapui/GDAServices-soapui-project]
    [INFO] ------------------------------------------------------------------------
    [DEBUG] Trace
    org.apache.maven.BuildFailureException: SoapUI Test(s) failed
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    Caused by: org.apache.maven.plugin.MojoFailureException: SoapUI Test(s) failed
    at com.eviware.soapui.maven2.TestMojo.execute(TestMojo.java:127)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    ... 17 more


    Am I using the wrong parameter?

    Best regards

    Daniel
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Daniel,

    hmm.. could you clear out the eviware folder in your local m2 repository to make sure you have the latest files downloaded?

    Let me know what happens..

    regards,

    /Ole
    SmartBear Sweden
  • Hi Ole,

    same result:

     ERROR [SoapUI] An error occured [Failed to load project from file [file:/D:/LzfD-IDE/src/gda/trunk/system-test/src/test/soapui/GDAServices-soapui-project/]], see error log for details


    Best regards

    Daniel
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Daniel,

    hmm.. and is the error in the error log the same?

    If it is, could you pack and send your project to support@eviware.com so I can try to reproduce?

    regards,

    /Ole
    SmartBear Sweden
  • Hi Ole,

    interesting - when preparing the example project to reproduce the problem I noticed that the error only happens as long as a "globalProperties" Element exists in the configuration.

    We are using a global property to configure the base url of the endpoints used in test requests (unfortunately, I left that out in my previous post):


    <configuration>
    [...]
    <globalProperties>
    <globalProperty>conf.wsdl.base=http://localhost:9876/base_url</globalProperty>
    </globalProperties>
    [...]
    </configuration>


    When I remove that part from the plugin configuration the project is executed (the tests in the example fail, but that is not the issue).

    The zip file containing the sample project and log output of a failed run is on its way.

    Best regards

    Daniel
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Daniel,

    yes, I can confirm that this is related to the global properties specified in the pom. I've filed this as a bug to be prioritized and fixed accordingly.

    regards!

    /Ole
    SmartBear Sweden
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello,

    We did not hear from you regarding bug you reported. We introduced the fix for it, but did not got
    confirmation from you. We are assuming this is working for you now.

    Thanks,
    robert
    /SmartBear