我在 target machine as standalone program 设置了 mstest 而没有安装visual studio . 所以我复制了目标机器所需的文件(* .exe 's,dll' s)mstest,并在gac中注册了所有dll,mstest需要运行单元测试 .
Works fine so far for normal unit tests.
我尝试设置mstest来运行编码的ui测试 . 我将一些新的dll复制到目标机器:
- Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll
- Microsoft.VisualStudio.TestTools.UITest.Common.dll,TestTools.UITest.Extensions.dll
- Microsoft.VisualStudio.TestTools.UITesting.dll
- Microsoft.VisualStudio.HostingProcess.Utilities.Sync
但是当我在我的目标机器上尝试 execute a test on cmd.exe via mstest.exe 时, the test will run but always fail (在我的本地机器上工作正常,Visual Studio 2012) . 这是一个非常简单的测试:
- just click on "Start",
- type in "calc press enter"
两台机器都使用相同的操作系统 .
我猜MSTest.exe still needs some dll's 来执行codedUiTests . 坏的是丢失的dll没有显示在cmd.exe中,没有错误,没有任何提示:/
测试运行正常,但将无法通过所有测试 .
cmd-output:
Microsoft (R) Test Execution Command Line Tool Version 11.0.50727.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading D:\Users\Jenkins\Desktop\CodedUITestProject1\CodedUITestProject1\bin\Debug\CodedUITestProject1.dll...
Starting execution...
Results Top Level Tests
------- ---------------
Failed CodedUITestProject1.CodedUITest1.CodedUITestMethod1
0/1 test(s) Passed, 1 Failed
Summary
-------
Test Run Failed.
Failed 1
---------
Total 1
Results file: C:\VS2011Stub\Common7\IDE\TestResults\Jenkins_MSGP166C 2013-05-24 12_36_28.trx
Test Settings: Default Test Settings
Does anyone know what files mstest.exe needs to run codeduitests in a correct way?
Edit: 我检查了* .trx文件并将丢失的dll复制到我的目标机器上 .
我试图再次运行测试,它再次失败 . 我再次检查trx文件,得到了一条很棒的消息:/
<Results>
<UnitTestResult executionId="4652eeb1-e1b4-4782-a288-dbd4bb0bda5a" testId="484ddbfe-fdc6-0f5d-9e7b-bab4da5b5905" testName="CodedUITestMethod1" computerName="MSGP166C" duration="00:00:00.0887388" startTime="2013-05-24T16:30:24.1716290+02:00" endTime="2013-05-24T16:30:24.6266745+02:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Failed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="4652eeb1-e1b4-4782-a288-dbd4bb0bda5a">
<Output>
<ErrorInfo>
<Message>Error calling Initialization method for test class CodedUITestProject1.CodedUITest1: System.IO.FileNotFoundException: Das System kann die angegebene Datei nicht finden. (Ausnahme von HRESULT: 0x80070002)</Message>
<StackTrace> bei System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
bei System.Reflection.Assembly.LoadFile(String path)
bei Microsoft.VisualStudio.TestTools.UITest.Framework.UITestExtensionPackageManager.LoadAssembly(String assemblyFile)
</StackTrace>
</ErrorInfo>
</Output>
</UnitTestResult>
</Results>
So what Assembly is missing now?? 没有提到 .
提前致谢
1 回答
我没有尝试复制dll,而是安装了VS Test Agents . 它比视觉工作室轻得多,并且会让你获得mstest . 这是我在测试机器上运行CodedUI测试时使用的方法 .
http://search.microsoft.com/en-us/DownloadResults.aspx?q=test+agents
下载您构建项目的测试代理版本 . (并不重要)
打开安装程序时将有3个选项 . 你想要测试代理 .
您现在应该拥有mstest和codedui所需的一切
另一个运行良好的是将所有的encodeui测试放入有序测试并将其传递给mstest .
MSTest /TestContainer:OrderedTest1.orderedtest
应该做的伎俩