开发者

Web service unit testing

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜