如何MSTest的确定在其中运行的测试方法的顺序? [英] how does MSTest determine the order in which to run test methods?

查看:1912
本文介绍了如何MSTest的确定在其中运行的测试方法的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:注意,怀疑288805是相似的,但是,我专门问我如何做MSTest的选择默认测试程序。请看到这个问题的其余部分。感谢您对Eilon 的链接

edit: note, question 288805 is similar, however, I specifically am asking how does MSTest choose the default test order. Please see the rest of this question. Thank you Eilon for the link.

我一直在寻找在传统MSTest的项目。
测试以相同的顺序总是运行。
的顺序不是字母,并反弹方法之间
两个*的.cs TestMethod的文件。

I was looking at a legacy MSTest project. The tests were always running in the same order. The order was not alphabetic and was bouncing between methods in two *.cs TestMethod files.

我没有改变的物理顺序传统
码。我做了我的便利追加MSTest01
的第一次测试,MSTest02到第二个测试,等等的
方法名的方法名。

I did not change the physical order of the legacy code. I did for my convenience append "MSTest01" to the method name of the first test, "MSTest02" to the method name of the second test, et cetera.

要我惊讶的是,的TestMethod的
功能的执行顺序更改; #3首先,#6秒,5号第三,
等等。

To my surprise, the execution order of the TestMethod functions changed; #3 first, #6 second, #5 third, et cetera.

当我删除从
TestMethod的功能MSTestnn字符串名,它们的执行顺序
变回到以前的顺序,即,
从第一cs文件一个试验中,从$ b $两个试验b中的第二cs文件中,从第一$五个测试b $ b cs文件,等等。

When I removed the "MSTestnn" strings from the TestMethod function names, their execution order changed back to the previous ordering, i.e., one test from the first .cs file, two tests from the second .cs file, five tests from the first .cs file, et cetera.

看来,文件的位置可能不是一个因素
,而TestMethod的函数名的可能是一个因素

It seems that file location may not be a factor while TestMethod function name may be a factor.

问:谁能解释MSTest的是如何决定对TestMethod的功能执行顺序

QUESTION: can anyone explain how MSTest decides on execution order of TestMethod functions?

推荐答案

在MSDN说; - )

The MSDN says ;-)

如何创建一个有序的测试

How to: Create an Ordered Test

http://msdn.microsoft .COM / EN-US /库/ ms182631.aspx

MSTest.exe命令行选项

MSTest.exe command-line options

http://msdn.microsoft.com/en-us/library/ms182489(v = vs.120)的.aspx

这篇关于如何MSTest的确定在其中运行的测试方法的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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