NUnit 参数化测试的 MSTest 等价物? [英] MSTest Equivalent for NUnit's Parameterized Tests?

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

问题描述

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.

推荐答案

Would 这个有帮助吗?

Would this help?

这周我添加了一些单元测试到由 TFS 管理的项目,所以我决定使用核心"单位测试框架可用VS2008,不幸的是它没有支持行测试.但它有一个类似的称为数据驱动单元测试的功能.用这种方法它有点多实现简单"的复杂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.

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

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