是否可以在Visual Studio c#中指定测试的顺序? [英] Is it possible to specify the order of the tests in Visual Studio c#?

查看:113
本文介绍了是否可以在Visual Studio c#中指定测试的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在同一个名称空间中进行了多个测试.我没有为每个单元测试使用诸如Test1,Test2等的命名约定.因此,现在当我运行所有测试时,它们并没有按照我想要的顺序运行.有订购测试的方法吗?

I have several tests in the same namespace. I did not use naming convention like Test1, Test2, ... etc for each of my unit tests. So, now when I run all tests, they don't run in the order I want them to. Is there a way to order tests?

如果我不按特定顺序执行测试,则测试不会失败.但是,我只是想按照它们在我的测试用例电子表格中的顺序执行它们.

My tests do not fail if I don't execute them in a particular order. However, I was just wanted to execute them in the order they are in my test case spreadsheet.

推荐答案

您正在寻找的答案是是".尽管我同意隔离的原则,但是在某些情况下,您需要测试一系列事件.在VS 2010中,您可以创建一个新的有序测试"以按顺序捆绑和测试一组测试.

The answer you are looking for is Yes. Although I agree with the principles of isolation there are scenarios where you need to test a sequence of events. In VS 2010 you can create a new 'Ordered Test' to bundle and test a set of tests sequentially.

这篇关于是否可以在Visual Studio c#中指定测试的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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