Visual Studio/mstest如何识别测试项目? [英] How does Visual Studio /mstest identify test projects?
问题描述
说(假设为100%),我无意中将一个单元测试项目作为项目类型类库"添加到VS2010解决方案中.然后,我添加了将其作为单元测试项目运行所需的程序集,但是当我单击在解决方案中运行所有测试"时,MSTest不会继续使用它.这里的标准是什么?
Say (100% hypothetically) that I've accidentally added a unit test project as project type "Class library" to a VS2010 solution. I've then added the assemblies needed to run it as a Unit Test project, but MSTest won't pick up on it when I hit "Run all tests in solution". What are the criterias here?
我有一些理论,到目前为止都失败了:
I had a couple of theories, which all have failed so far:
- .testsettings文件中的内容(据我所知,这里没有引用任何程序集)
- .SLN文件中的内容(找不到任何内容)
- AssemblyInfo.cs中的内容(不,不是)
- 通过引用(...)UnitTestFramwork.dll隐式表示(不是Obv)
有人吗?
推荐答案
在项目文件中,有一个名为ProjectTypeGuids
的XML元素,其中包含一些表示测试项目的GUID.示例如下.
In the project file, there's an XML element with the name ProjectTypeGuids
, that holds a few GUIDs that denote test project. Example as follows.
<Project>
<PropertyGroup>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
</Project>
以下是Visual Studio 2010的已知项目类型GUID的列表: http: //onlinecoder.blogspot.com/2009/09/visual-studio-projects-project-type.html
Here's a list of known project type GUIDs for Visual Studio 2010: http://onlinecoder.blogspot.com/2009/09/visual-studio-projects-project-type.html
在上面的示例中,它显示了该项目的类型为 Test 和 Windows(C#).
In the example above, it shows the project to be of type Test and Windows (C#).
这篇关于Visual Studio/mstest如何识别测试项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!