简体   繁体   English

Java Webservice测试

[英]Java Webservice testing

I provide a web service to my organisation. 我向我的组织提供Web服务。 i was wondering would anyone recommeding the use of apache cactus for setting up a testing framework or has anyone worked with any other web service frameworks that may be useful? 我想知道是否有人会建议使用apache仙人掌来建立测试框架,还是有人可以与其他任何有用的Web服务框架一起使用?

Thanks Damien 谢谢达米安

As you are dealing with a web service you would not need to use Jakarta Cactus and could get away with writing plain old JUnit tests. 在处理Web服务时,您无需使用Jakarta Cactus,并且可以摆脱编写简单的旧JUnit测试的麻烦。

The tests would take two forms: 测试将采取两种形式:

1. Does the underlying functionality work as expected? 1.基本功能是否按预期工作?

This has nothing to do with the web service itself but the underlying functionality it provides. 这与Web服务本身无关,但与它提供的基本功能无关。 eg Does your Data access objects retrieve/process data correctly? 例如,您的数据访问对象是否正确检索/处理数据? Hopefully your web service interface and the underlying functionality are not tightly coupled. 希望您的Web服务界面和底层功能没有紧密结合。

2. Does the live web service (be it SOAP/REST/XMLRPC) function correctly? 2.实时Web服务(无论是SOAP / REST / XMLRPC)是否正常运行?

In this case a good way to test this is to build a web service client and write tests to see whether this client works correctly against the web service. 在这种情况下,进行测试的一个好方法是构建一个Web服务客户端,并编写测试以查看该客户端是否可以针对Web服务正常工作。 eg Use Axis/CXF/XFire to build the web service client and then write JUnit tests for the data it returns. 例如,使用Axis / CXF / XFire构建Web服务客户端,然后为其返回的数据编写JUnit测试。

Also remember to target your testing towards what the end users of this web service will be using. 还请记住将测试针对此Web服务的最终用户将使用的内容。 If you have written a Java web service but it is being consumed by .Net clients then make sure you test the service against a .Net client. 如果编写了Java Web服务,但.Net客户端正在使用它,则请确保针对.​​Net客户端测试该服务。 SOAP services are especially troublesome when it comes to consistent cross-platform behavior. 当涉及到一致的跨平台行为时,SOAP服务尤其麻烦。

There is an open source application called SoapUI( http://www.soapui.org/ ). 有一个名为SoapUI( http://www.soapui.org/ )的开源应用程序。 With this application, you can do 1) manual testing of webservices OR 2) use groovy (a java like scripting) language to do functional testing. 使用此应用程序,您可以执行以下操作:1)手动测试Web服务或2)使用groovy(类似于脚本的Java)语言进行功能测试。

It works pretty well and a lot of organizations are using it. 它运行良好,许多组织都在使用它。 They have an open source version as well as a commercial (with more functionality and support) version. 它们具有开源版本以及商业版本(具有更多功能和支持)。 Check it out. 看看这个。

Apache于2011/08/05退休了Jakarta Cactus,因此不建议在任何新项目中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM