How should I Unit Test WebServiceTemplate (SpringWS)

I am trying to find a better way to write unit tests for Spring WebService template classes. What I'm trying to do is check that I correctly connect these classes for each type of request / response that my client produces. I also want to make sure that if the exception is returned, the exception is handled correctly.

I guess what I'm trying to do is figure out how to make the actual send / receive calls.

Any suggestions?

+3
source share
4 answers

I am going to be sticky and answer my question.

, Spring WS 2.0 , , ( http://blog.springsource.com/2011/01/11/spring-web-services-2-0-released/):

-   MockWebServiceServer.    , -    ,    ,      .   ,    ,    .

:

  • MockWebServiceServer.
  • (-) .
  • WebServiceTemplate , .
  • MockWebServiceServer.verify(), .

, , - spring -ws 1.5.9. 2.0 , -. , .

+4

, WebServiceTemplate. WebServiceOperations , , . , java, .

, , , , , -.

unit test. - .

+5

, , "unit test", , , WebServiceTemplate . unit test , , WebServiceTemplate, , , WST , ..

, , ( Spring), Spring TestContext Framework. , @ContextConfiguration({"path/to/spring/xml"}), Spring ApplicationContext @Autowired .

: , webservice, - , , , - ? ? ? .. unit test.

+1

soapUI is a good option for testing your open WS. You can process special test requests or automate predefined tests in various ways.

-1
source

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


All Articles