自动测试Web服务通信 [英] Automate test of web service communication

查看:78
本文介绍了自动测试Web服务通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将消息发送到外部Web服务的应用程序.我使用 MSBuild 构建和部署该应用程序 Cruisecontrol.NET .在CCNET构建和部署应用程序时,它还使用 NUnit 运行一组测试.我现在也想测试Web服务通信.

I have an application that sends messages to an external web service. I build and deploy this application using MSBuild and Cruisecontrol.NET. As CCNET build and deploys the app it also runs a set of test using NUnit. I'd now like to test the web service communication as well.

我的想法是,应在构建过程中生成一个Web服务(基于外部Web服务WSDL)并将其部署到构建服务器的本地Web服务器上. Web服务应该做的就是接收消息并将其放置在文件系统上,这样我就可以使用例如普通的NUnit对其进行检查.这也将使开发更加容易,因为新开发人员只需运行构建脚本并启动并运行(不必花费时间来建立与第三方服务的连接).

My idea is that as part of the build process a web service should be generated (based on the external web services WSDL) and deployed to the build servers local web server. All the web service should do is to receive the message and place it on the file system so I then can check it using ordinary NUnit for example. This would also make development easier as new developers would only have to run the build script and be up and running (not have to spend time to set up a connection to the third party service).

有没有现有实用工具,可以轻松地基于WSDL模拟Web服务?是否有人使用MSBuild 做过类似的事情?

Are there any existing utilities out there that easily mock a web service based on a WSDL? Anyone done something similar using MSBuild?

是否有其他方法可以测试这种情况?

推荐答案

我刚刚开始研究 http://www .soapui.org/,它似乎可以很好地测试Web服务.

I just started looking into http://www.soapui.org/ and it seems like it will work nicely for testing web services.

还可以看看在Web服务中添加一个抽象层,每个服务调用将直接调用一个可测试的方法(在Web范围之外)?我只是用我正在做的一个更大的项目来做到这一点的,它的可测试性很好地工作了.

Also, maybe look at adding an abstraction layer in your web service, each service call would directly call a testable method (outside of the web scope)? I just did this with a bigger project I'm working on, and it's testability is working nicely.

这篇关于自动测试Web服务通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆