我可以使用什么动态语言进行 .NET 单元测试?

发布于 2024-07-18 01:42:27 字数 307 浏览 7 评论 0原文

我正在尝试为我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蝶舞 2024-07-25 01:42:27

我推荐 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.

哆兒滾 2024-07-25 01:42:27

我更喜欢 C# 进行单元测试...如果您正在寻找动态语言,您可以尝试 Iron-Python...

I prefer C# for unit testing... If you are looking for dynamic language you can try iron-python for that....

墟烟 2024-07-25 01:42:27

对于 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文