Visual Studio .NET - 使用 Gallio Integration 进行 MbUnit 测试 - 多个断言的问题
我正在使用 gallio 将 mbunit 的测试运行程序与 Visual Studio 中的 mstest 测试运行程序集成。它工作得非常好 - 除非我使用多个断言语句运行测试。测试将根据 FIRST 断言语句通过或失败。我知道很多人反对多重断言,但在行测试和组合测试等接收多行输入的情况下,这是不可避免的。如果从 gallio 的 icarus gui 执行,所有测试都将成功运行。还有其他人遇到/解决过这个问题吗?
编辑:这是一个代码示例
(我显然在 c# 中得到了相同的结果)
<Test()> _
<MultipleAsserts()> _
<Row(3, 3)> _
<Row(3, 17)> _
<Row(1, 2)> _
Public Sub MyRowTest(ByVal val1 As Int32, ByVal val2 As Int32)
Assert.AreEqual(Of Int32)(val1, val2)
End Sub
当通过 Visual Studio 运行时,测试通过,我得到:
MyRowTest(3,3) 持续时间:0.016s,
断言:2
I am using gallio to integrate mbunit's test runner with the mstest test runner in visual studio. it works VERY well - except when I am running a test with multiple assert statements. The test will either pass or fail based on the FIRST assert statement. I know a lot of people are against multiple asserts, but they are unavoidable in cases such as rowtests and combinatorial tests which receive multiple lines of input. All tests will be run successfully if executed from gallio's icarus gui. Has anyone else come across/fixed this issue?
Edit: Here is a code sample
(I obviously get the same results in c#)
<Test()> _
<MultipleAsserts()> _
<Row(3, 3)> _
<Row(3, 17)> _
<Row(1, 2)> _
Public Sub MyRowTest(ByVal val1 As Int32, ByVal val2 As Int32)
Assert.AreEqual(Of Int32)(val1, val2)
End Sub
When run through Visual Studio the test passes and I get:
MyRowTest(3,3) Duration: 0.016s,
Assertions: 2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊,我明白了。
您的意思是 Visual Studio 的测试视图仅根据行测试的一行来考虑测试通过或失败。我不认为这与多个断言有任何关系。
这里的问题是 Visual Studio 的测试模型非常有限,并且不太适合某些 MbUnit 功能。即便如此,Gallio 还可以采取更多措施来提高 Visual Studio 中数据驱动测试的可用性。
我在这里开了一个问题:
http://code.google.com/p/mb-单元/问题/详细信息?id=509
Ahh, I see.
You meant that Visual Studio's Test View considers the test passed or failed based on only one row of a row-test. I don't think this has anything to do with multiple asserts.
The problem here is that Visual Studio's test model is very limited and is a poor fit for some MbUnit features. Even so, Gallio could do more to improve the usability of data-driven tests in Visual Studio.
I have opened an issue here:
http://code.google.com/p/mb-unit/issues/detail?id=509