user2169962
user2169962

Reputation: 23

Executing coded UI test from a target machine's mstest(standalone). Dll's/Files needed!! :(

i set up mstest on target machine as standalone program without installing visual studio. So i copied the files(*.exe's,dll's) mstest needed to the target machine and register all dlls in gac which mstest needs to run unit tests.

Works fine so far for normal unit tests.

Acually i try to setup mstest to run coded ui test. I copied some new dll's to the target machine:

- 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

But when i try to execute a test on cmd.exe via mstest.exe on my target machine, the test will run but always fail (works fine on my local machine, Visual Studio 2012). Its a pretty simple test:

  - just click on "Start", 
  - type in "calc press enter" 

Both machines use the same operating system.

I guess MSTest.exe still needs some dll's to perform codedUiTests. The bad thing is the missing dll's arent show up in cmd.exe, no errors, no hints just nothing :/
The test runs like normal but will fail all tests.

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: I checked the *.trx file and copied the missing dll's to my target machine.

I tried to run the test again, it failed again. I was checking the trx file again and got an awesome message :/

  <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?? It was not mentioned.



Thanks in Advance

Upvotes: 0

Views: 1600

Answers (1)

Zaq Wiedmann
Zaq Wiedmann

Reputation: 333

Instead of trying to copy over the dlls I would install VS Test Agents. It's much lighter than visual studio and will get you mstest. This is the approach I use when running CodedUI tests on a test machine.

http://search.microsoft.com/en-us/DownloadResults.aspx?q=test+agents

  1. Download the version of test agents that you built the project in. (doesn't really matter)
  2. There will be 3 options when you open the installer. You want test agents.
  3. You should now have everything you need for mstest and codedui

Another that works well is putting all of your codedui tests into an ordered test and passing that into mstest.

MSTest /TestContainer:OrderedTest1.orderedtest

should do the trick

Upvotes: 1

Related Questions