0

I am new in VS2013 and C#. I was trying to test the UI of a Webpage with VS CodedUITests and WebTests. This has been done successfully. I have my tests working when I run them manually.

The problem comes when I want to automate this process. Instead of using a Test Agent (I would need a second machine) I wanted to create a Build and run these tests right after a successful build. I created the build and it works fine (I get Build partially succeeded), but the tests do not run because somehow (even after successfully building) it cannot find UITesting reporting this error:

Run MSTest for Test Assemblies
   + d:\a\bin\CodedUITestProject1.dll
   + Unable to load the test container 'd:\a\bin\CodedUITestProject1.dll
     or one of its dependencies. Error details: System.IO.FileNotFoundException:
     Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITesting,
     Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one
     of its dependencies. The system cannot find the file specified.

I don't have this d:\a\bin path anywhere, so I suppose it is a temporary path for the build. I am not sure that what I am doing is possible or not. All I want is to build my projects and run these UI/Web tests, but maybe this is not the right approach. Any help with this?

UPDATE

This is the project's Local.testsettings:

<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="Local" id="38e7b5f5-3e94-4739-a620-dfb4ddfa9c35" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <Description>These are default test settings for a local test run.</Description>
  <Deployment>
    <DeploymentItem filename="..\CodedUITestProject1\" />
  </Deployment>
  <Execution>
    <TestTypeSpecific>
      <UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
        <AssemblyResolution>
          <TestDirectory useLoadContext="true" />
        </AssemblyResolution>
      </UnitTestRunConfig>
      <WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207" runUntilDataExhausted="true">
        <Browser name="Internet Explorer 10.0" MaxConnections="6">
          <Headers>
            <Header name="User-Agent" value="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)" />
            <Header name="Accept" value="*/*" />
            <Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
            <Header name="Accept-Encoding" value="GZIP" />
          </Headers>
        </Browser>
      </WebTestRunConfiguration>
    </TestTypeSpecific>
    <AgentRule name="LocalMachineDefaultRole">
    </AgentRule>
  </Execution>
  <Properties>
    <Property name="TestSettingsUIType" value="UnitTest" />
  </Properties>
</TestSettings>
makeMonday
  • 2,303
  • 4
  • 25
  • 43
  • it's not a temporary path..you need to look at your build definitions have you checked that out..? can you check the .config file as well, if the build is looking at any of the config settings..? – MethodMan Mar 25 '15 at 16:39
  • In the `Staging location` section at `Build Defaults` tab I have the option `Copy build output to the server` selected. I do not know where is this `.config` file, I do have a `Local.testsettings` file. – makeMonday Mar 25 '15 at 16:43
  • can you check the `Settings.settings` if you are using that..also did you right click on the project and select the properties which can take you to all of the stuff that you should be checking to make sure that the path to `d:` is not there – MethodMan Mar 25 '15 at 16:45
  • I'll add my `settings` to the question. – makeMonday Mar 25 '15 at 16:48
  • what will adding the setting's accomplish.. you need to check the properties of the project and under the build option.. look to see what those values are... look at the `Build Events` for this project – MethodMan Mar 25 '15 at 16:49
  • Ok, the `Build Events` tab of this project is totally empty. – makeMonday Mar 25 '15 at 16:54
  • take a look here.. I think this may shed some light http://stackoverflow.com/questions/3738819/do-mstest-deployment-items-only-work-when-present-in-the-project-test-settings-f – MethodMan Mar 25 '15 at 16:56
  • Ok, I have read the other question, but I think that it is a bit different, since he is using those options to "keep track" of an input/output file. What I am dealing with here is a problem with a Visual Studio library/component, which is not in my solution. – makeMonday Mar 26 '15 at 15:51

1 Answers1

0

It is necessary to have the same version of Visual Studio on the Build Server. In this case I was compiling and running Coded UI Tests, so I needed, at least, Visual Studio Premium.

makeMonday
  • 2,303
  • 4
  • 25
  • 43