mstest错误 - qtagent32.exe已停止工作

时间:2014-02-25 13:47:41

标签: .net mstest

我构建了一个简单的测试dll(net 3.5,Debug,x86)

using Microsoft.VisualStudio.TestTools.UnitTesting;    
namespace TestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            Assert.AreEqual("111", "111");
        }
    }
}

当我从cmd运行mstest工具时:

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe"  /testcontainer:"TestProject1.dll"

我收到此错误: enter image description here

但如果TestProject1将使用net 4.0

进行构建,则测试有效

我有一个Windows 7旗舰版,VS 2010和2013没有任何更新。 谁能帮我。谢谢!

1 个答案:

答案 0 :(得分:2)

在此处查看类似问题:mstest.exe vs2012 crashes qtagent32.exe

注意,我没有按照列出的任何解决方案,但我按照a Microsoft article中列出的解决方法使用vstest.console.exe而不是mstest.exe。

(另请注意,vstest.console.exe的参数不同。它需要一个以空格分隔的test.dll列表)

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "TestProject1.dll"

这是我的msbuild设置,它做同样的事情:

<PropertyGroup>
  <MSTEST>"$(VS110COMNTOOLS)..\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"</MSTEST>
</PropertyGroup>
...
<Target Name="MyTests" >
  <ItemGroup>
    <!-- These Items should be evaluated at Target runtime -->
    <TestFiles Include="..\Tests\**\bin\$(Configuration)\*.Test.dll" />
  </ItemGroup>
  <!-- Run Tests -->
  <PropertyGroup>
    <!--TestSuccessOrNot is the property specify whether the Test is sucess or not -->
    <TestSuccessOrNot>1</TestSuccessOrNot>
  </PropertyGroup>
  <Exec Command="$(MSTEST) @(TestFiles, ' ')" >
    <Output TaskParameter="ExitCode" PropertyName="TestSuccessOrNot"/>
  </Exec>
  <Error Text="Tests Failed" Condition="$(TestSuccessOrNot) == '1'" />
</Target>
相关问题