开发者

Web service unit testing

开发者 https://www.devze.com 2022-12-25 18:51 出处:网络
I\'m using JAX-开发者_开发问答WS web services (client and exposed services), is there any API to test these web services?JAX-WS web services are annotated POJOs so you can unit test them (in isolation

I'm using JAX-开发者_开发问答WS web services (client and exposed services), is there any API to test these web services?


JAX-WS web services are annotated POJOs so you can unit test them (in isolation) using a regular unit testing framework (JUnit, TestNG) and Mocks.


  • test the services out of their "web-service" context.
  • Use WSUnit to test consumers.
  • take a look at this article

Unit tests are meant to test units of code. They should test business logic, and not infrastructure. So this is not exactly "unit-testing" if you want to test the services within the web-service context.


For functional testing - you can use tools like soapUI (but I don't recommend this option because tests created with this tool are really hard to maintain). Other option (recommended) is using JUnit tests in which you create the service + client and exercise service methods. In our project we use Apache CXF and it works very well. It also supports JAX-WS.

For unit testing - "regular" JUnit, since generated service is Plain Java Object.


you can use Jersey to test end points: http://jersey.java.net/nonav/documentation/latest/test-framework.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号