0
votes

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

1
Don't you get any error or exception when the test fails? - chaliasos
no, it just says that the test in the codeduitest.dll failed :/ - user2169962
Open the .trx file via VS to see the error. It should be visible in it. There are many things that must be configured and many reasons that your test fails. If you don't give us any hint, unfortunately we can't help you. - chaliasos
yeap i checked this file now and copied the needed dll to my target machine. But i still got a FileNotFoundException in the next trx file with awesome content: <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> :( Wich Assembly is missing???????? huh??? - user2169962
the normal Exception looks like this: <Message>Error calling Initialization method for test class CodedUITestProject1.CodedUITest1: System.IO.FileNotFoundException: Die Datei oder Assembly "Microsoft.VisualStudio.Diagnostics.Measurement, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.</Message> but it doesn say which file couldnt be found in the new trx file :/ - user2169962

1 Answers

1
votes

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