C# 什么是执行集成测试的好方法?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/849467/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Whats a great way to perfom integration testing?
提问by David Kiff
We have written our own integration test harness where we can write a number of "operations" or tests, such as "GenerateOrders". We have a number of parameters we can use to configure the tests (such as the number of orders). We then write a second operation to confirm the test has passed/Failed (i.e. there are(nt) orders).
我们已经编写了自己的集成测试工具,我们可以在其中编写许多“操作”或测试,例如“GenerateOrders”。我们有许多参数可用于配置测试(例如订单数量)。然后我们编写第二个操作来确认测试已通过/失败(即有(nt)个订单)。
The tool is used for
该工具用于
- Integration Testing
- Data generation
- End-to-end testing (By mixing and matching a number of tests)
- 集成测试
- 数据生成
- 端到端测试(通过混合和匹配多个测试)
It seems to work well, however requires development experience to maintain and write new tests. Our test team would like to get involved, who have little C# development experience.
它似乎运行良好,但是需要开发经验来维护和编写新测试。我们的测试团队希望参与其中,他们几乎没有 C# 开发经验。
We are just about to start a new Greenfield project and I am doing some research into the optimum way to write and maintain integration tests.
我们即将开始一个新的 Greenfield 项目,我正在研究编写和维护集成测试的最佳方式。
The questions are as follows:
问题如下:
- How do you perform integration testing?
- What tool do you use for it (FitNess?, Custom?, NUnit)?
- 你如何进行集成测试?
- 你使用什么工具(FitNess?,Custom?,NUnit)?
I am looking forward to peoples suggestions/comments.
我期待着人们的建议/意见。
Thanks in advance,
提前致谢,
David
大卫
采纳答案by ottodidakt
Integration testing may be done at a user interface level (via automated functional tests - AFT) or service/api interface level.
集成测试可以在用户界面级别(通过自动化功能测试 - AFT)或服务/api 界面级别完成。
There are several tools in both cases:
在这两种情况下都有几种工具:
I have worked on projects that successfully used Sahior Seleniumfor AFT of web apps, whitefor AFT for .NET WPF or winforms apps, swtBotfor AFT of Eclipse Rich client apps and frankensteinfor AFT of Java swing apps.
我已经上成功使用项目工作SAHI公司或硒的AFT Web应用程序的,白色的AFT用于.NET WPF或WinForms的应用,了SWTBot为Eclipse富客户端应用程序的AFT和科学怪人的Java应用程序摆动的AFT。
Fitnesse is useful for service/api level tests or for tests that run just below the UI. When done right, it has the advantage of having business-readable tests i.e. non-developers can read and understand the tests. Tools like NUnit are less useful for this purpose. SOAPUIis particularly suited for testing SOAP web services.
Fitnesse 对于服务/api 级别测试或在 UI 下方运行的测试很有用。如果做得好,它具有业务可读测试的优势,即非开发人员可以阅读和理解测试。NUnit 之类的工具对此目的不太有用。SOAPUI特别适用于测试 SOAP Web 服务。
Factors to consider:
需要考虑的因素:
- Duration: Can you tolerate 8 hour test runs?
- Brittleness: AFTs can be quite brittle against an evolving application (e.g. ids and positions of widgets may change). Adequate skill and effort is needed to not hard code the changing parts.
- Fidelity: How close to real world do you want it to be? e.g. You may have to mock out interactions with a payment gateway unless the provider provides you a test environment that you can pummel with your tests.
- 持续时间:你能忍受 8 小时的测试运行吗?
- 脆性:AFTS可以对抗一个不断发展的应用相当脆(例如窗口小部件的ID和位置可以改变)。需要足够的技能和努力来不对不断变化的部分进行硬编码。
- Fidelity:您希望它与现实世界有多接近?例如,您可能必须模拟与支付网关的交互,除非提供商为您提供了一个测试环境,您可以通过测试进行测试。
Some nuances are captured here.
Full disclosure: The author is associated with the organization behind most (not all) of the above free and open source tools.
完全披露:作者与上述大多数(不是全部)免费和开源工具背后的组织有关。
回答by Bernhard Hofmann
It's not out of Beta yet, but StoryTellerlooks promising:
它还没有结束 Beta 版,但StoryTeller看起来很有希望:
回答by Jeffrey Cameron
You could try the Concordionframework for writing user acceptance tests in HTML files. It takes a BDD-style approach. There is a .Net portas well
您可以尝试使用Concordion框架在 HTML 文件中编写用户验收测试。它采用 BDD 风格的方法。有一个净端口以及