如何为课程中的所有测试设置测试类别 [英] How to set test category for all tests in the class

查看:90
本文介绍了如何为课程中的所有测试设置测试类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 MSTest ,并且我想为其中的所有方法设置相同的测试类别一次测试类,而无需分别为每个方法设置TestCategory属性.该怎么办?

最方便,最明显的方法是在类上设置TestCategory属性,但只能将其应用于方法.

最终的目标是在TFS签入的测试运行期间跳过集成测试.

解决方案

要能够在 class 级别设置[TestCategory]属性,请使用NuGet安装"MSTest V2" TestFramework. /p>

引用:MSTest, and I want to set the same test category for all methods in test class at once, without setting TestCategory attribute to each method individually. How can this be done?

The most convenient and obvious way would be to set TestCategory attribute on class, but it can be applied to methods only.

The ultimate goal is to skip integration tests during test run on TFS check-in.

解决方案

To be able to set the [TestCategory] attribute at the class level, install the "MSTest V2" TestFramework using NuGet.

Ref: https://blogs.msdn.microsoft.com/devops/2016/06/17/taking-the-mstest-framework-forward-with-mstest-v2/

这篇关于如何为课程中的所有测试设置测试类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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