MSTest是否等效于NUnit的参数化测试? [英] MSTest Equivalent for NUnit's Parameterized Tests?

查看:187
本文介绍了MSTest是否等效于NUnit的参数化测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NUnit支持一项功能,您可以为要多次运行的单元测试指定一组数据输入.

NUnit supports a feature where you can specify a set of data inputs for a unit test to be run multiple times.

[RowTest]
[Row(1001,1,2,3)]
[Row(1,1001,2,3)]
[Row(1,2,1001,3)]
public void SumTests(int x, int y, int z, int expected)
{
   ...
}

使用MSTest完成相同类型的事情的最佳方法是什么?我找不到相似的属性集.

What's the best way to accomplish this same type of thing using MSTest? I can't find a similar set of attributes.

推荐答案

这周我要添加一些单元测试 到由TFS管理的项目中, 所以我决定使用核心"单元 提供的测试框架 VS2008,不幸的是它没有 支持RowTests.但是它有一个相似的 称为数据驱动单元测试的功能. 通过这种方法,可以得到更多 实施复杂的简单" RowTest场景,但它也允许 实施更复杂的系统.

This week I was adding some unit tests to a project that is managed by TFS, so I decided to use the "core" unit testing framework available with VS2008, and unfortunately it doesn't support RowTests. But it has a similar feature called Data-Driven Unit Test. With this approach it's a bit more complicate to implement the "simple" RowTest scenario, but it allows also to implement more complicate ones.

这篇关于MSTest是否等效于NUnit的参数化测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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