我可以使用什么动态语言进行 .NET 单元测试?
我正在尝试为我的 C# 代码编写一些复杂的验收测试。 我注意到,当我编写测试时,我进行了大量显式转换以满足 C# 编译器的要求。 我喜欢使用 C# 等静态类型语言在生产代码中获得的类型安全性,但对于我的测试,我很乐意使用动态类型语言(例如 IronPython 或 IronRuby)来避免所有显式转换。 如果我的测试调用对象上不存在的方法,则代码在运行时失败是可以的(这只是一个失败的测试)。 我目前正在使用MS Test作为我的单元测试框架,如果我能继续使用它会很方便。 我可以使用哪种动态(基于 DLR)语言来与 MS Test 集成? 如果您认为有帮助,请随意建议不同的测试框架。
I am trying to write some complicated acceptance tests for my C# code. I notice that when I am writing my tests I am doing a lot of explicit casting to satisfy the C# compiler. I like the type-safety I get in my production code with a statically-typed language like C#, but for my tests I would be happy to use a dynamically-typed language (e.g. IronPython or IronRuby) to avoid all the explicit casting. If my test calls a method that doesn't exist on an object, it would be OK for the code to fail at run time (it's just a failing test). I am currently using MS Test as my unit testing framework, and it would be convenient if I could continue to use it. What dynamic (DLR-based) language can I use that will integrate with MS Test? Feel free to suggest a different testing framework, if you think that would help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我推荐 IronPython —— 它的优点之一是优秀的书《IronPython in Action》,它将引导您完成每个重要的方面,包括测试。
I recommend IronPython -- among its advantages is the excellent book "IronPython in Action" which will lead you through every important aspect, including testing.
我更喜欢 C# 进行单元测试...如果您正在寻找动态语言,您可以尝试 Iron-Python...
I prefer C# for unit testing... If you are looking for dynamic language you can try iron-python for that....
对于 IronRuby 和 Rspec,您可以查看这篇文章:
http://msdn.microsoft .com/en-us/magazine/dd453038.aspx
和 http://msdn.microsoft.com/sv-se/magazine/dd434651(en-us).aspx 用于开始使用 IronRuby .Net 互操作。
然后总是有 Fitnesse:
http://www.fitnesse.org/
Fitnesse .net 1.1 和 2.0 二进制文件可以在这里找到:http://fitnesse.org/FitNesse.DotNet
For IronRuby and Rspec you could check out this post:
http://msdn.microsoft.com/en-us/magazine/dd453038.aspx
And http://msdn.microsoft.com/sv-se/magazine/dd434651(en-us).aspx for getting started with IronRuby .Net interop.
Then there is always fitnesse:
http://www.fitnesse.org/
Fitnesse .net 1.1 and 2.0 binaries can be found here: http://fitnesse.org/FitNesse.DotNet