SoapUI Mock Integrated into Maven Test

I was wondering how to run some integration tests for WSClient. My project is built using maven.

To check the initialization of the configuration and some requests, I thought it would be nice to start the SoapUI Mock service. Then I got into this configuration, extracted 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 was supposed to be running at http://127.0.0.1:8181/somepath , where my WSClient could send requests. But I could not start the layout during the mvn test phase.

Is this a suitable way to test WSClients? In this case, where is the problem or the wrong configuration?

EDIT: no errors. I do not see how to mock this port 8181 . The only messages I see (from soapui.log) are as follows:

 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 

What are you in advance and kind,

Ruben

+6
source share
1 answer

According to http://www.soapui.org/Test-Automation/maven-2x.html you need to run the mock target instead of the test target. Please change the goal section to call the mock target:

  <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:

  • Make sure that you run the test layout in the step prior to running the tests, for example. in pre-integration-test or process-test-classes
  • Add the noBlock parameter with true .

See above for example.

+6
source

Source: https://habr.com/ru/post/911228/


All Articles