I was wondering how to perform some integration tests for a WSClient. My project is built with maven.
In order to test the configuration initialization and some requests I thought it was a good idea to start a SoapUI Mock service. Then I got into that configuration retrieved from some posts.
In my pom.xml
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>4.0.1</version>
<executions>
<execution>
<id>StartupMock</id>
<configuration>
<projectFile>src/test/soapui/MyMock-soapui-project.xml</projectFile>
<outputFolder>${project.build.directory}/surefire-reports</outputFolder>
<junitReport>true</junitReport>
<host>http://127.0.0.1:8181</host>
<mockService>DataProviderMock</mockService>
</configuration>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
My MockService called MyMock should have been started on http://127.0.0.1:8181/somepath where my WSClient could send the requests. But I wasn't able to start the mock during the mvn test
phase.
Is that the apropriate way to test WSClients? In that case, where is the problem or the misconfiguration?
EDIT: There is no error. I can't see the mock listening on that port 8181
. The only messages I see (from soapui.log) are:
2012-03-21 10:17:21,011 WARN [SoapUI] Missing folder [D:\proyectos\everest-utils\everest-bridge\trunk\.\ext] for external libraries
2012-03-21 10:17:21,392 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\rromero\soapui-settings.xml]
2012-03-21 10:17:23,205 INFO [WsdlProject] Loaded project from [file:/D:/proyectos/everest-utils/everest-bridge/trunk/src/test/soapui/MyMock-soapui-project.xml]
2012-03-21 10:17:23,891 INFO [SoapUITestCaseRunner] Running soapUI tests in project [DataProvider]
2012-03-21 10:17:23,894 INFO [SoapUITestCaseRunner] Running Project [MyMock], runType = SEQUENTIAL
2012-03-21 10:17:23,900 INFO [SoapUITestCaseRunner] Project [MyMock] finished with status [FINISHED] in 0ms
Than you in advance and kind regards,
Ruben
Maven is the latest build testing tool. It has several new features as compare to Ant, like dependency, etc. Maven is a project build or project management tool. It is used to check the compilation issues between framework components whenever multiple test engineer integrates their files into the same framework.
According to http://www.soapui.org/Test-Automation/maven-2x.html you need to run the mock
goal instead of the test
goal. Please change your goal
section to call the mock
goal:
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>4.6.1</version>
<executions>
<execution>
<id>StartupMock</id>
<configuration>
<projectFile>src/test/soapui/MyMock-soapui-project.xml</projectFile>
<outputFolder>${project.build.directory}/surefire-reports</outputFolder>
<junitReport>true</junitReport>
<host>http://127.0.0.1:8181</host>
<mockService>DataProviderMock</mockService>
<noBlock>true</noBlock>
</configuration>
<goals>
<goal>mock</goal>
</goals>
<phase>process-test-classes</phase>
</execution>
</executions>
</plugin>
Two more changes:
pre-integration-test
or process-test-classes
noBlock
option with true
.See above for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With