简体   繁体   English

如何在没有订购测试的情况下订购Visual Studio单元测试方法?

[英]How to Order Visual studio Unit test methods without Ordered Test?

I have 5 Unit test methods I want to order them. 我想订购5种单元测试方法。

How to do in VS2013? 在VS2013中怎么办?

Kindly guide me. 请指导我。

I have tried Ordered test but i need those method names to be displayed in Test explorer. 我已经尝试了有序测试,但是我需要那些方法名称显示在“测试资源管理器”中。

If your Unit Tests need to be ordered you're doing it wrong. 如果需要订购单元测试,那么您做错了。

[TestInitialize] and [TestCleanup] methods are ok, but you shouldn't be chaining them, or linking Unit Tests in order. [TestInitialize][TestCleanup]方法都可以,但是您不应该将它们链接起来,也不[TestCleanup]顺序链接单元测试。 This defeats the purpose. 这达不到目的。

Aim to have small, encapsulated, independent tests that stand on their own. 旨在拥有独立的小型,封装,独立测试。

Edit: 编辑:

method names to be displayed in Test explorer 在测试资源管理器中显示的方法名称

There is no need. 没有必要。 Order them in TestExplorer or name them with a prefix. 在TestExplorer中对其进行排序,或使用前缀命名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM