1
votes

When I'm trying to run a simple Coded UI Test project with one test method (which validates "add" functionality of Windows calculator app) using Team Foundation Server 2015 (update 4), I'm getting the following error at the test execution step -

Error calling Initialization method for test class CodedUITestProject1.CodedUITest1: 
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (http://go.microsoft.com/fwlink/?LinkId=255012)

    If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (http://go.microsoft.com/fwlink/?LinkId=254735)

    Stack Trace:

    at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()
    at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.BeforeTestInitialize(Object sender, BeforeTestInitializeEventArgs e)
    at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)
    at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()

Setup / Environment Details: OS: Windows Server 2012 Standard (64-bit OS, x64-based processor) VS: Visual Studio Enterprise 2015 with Update 3 TFS: Team Foundation Server 2015 with Update 4

Build definitions (build steps) [NOT XAML definitions]:

enter image description here

enter image description here

enter image description here

Run settings file used:

<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="TestSettings1" id="bd8c898e-4b22-407c-bc02-0861123a1dbd" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
    <Description>These are default test settings for a local test run.</Description>
    <Execution>
        <TestTypeSpecific>
            <UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
                <AssemblyResolution>
                    <TestDirectory useLoadContext="true" />
                </AssemblyResolution>
            </UnitTestRunConfig>
            <WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207">
                <Browser name="Internet Explorer 9.0" MaxConnections="6">
                    <Headers>
                        <Header name="User-Agent" value="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.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>

Did I miss any steps above? Please help me resolving the build failure problem.

Thanks in advance!

Regards,

Ayan

1
Do you have a test agent to run the test or just using build agent to run the test?Eddie Chen - MSFT

1 Answers

1
votes

You are using the wrong task. You need to use Run Functional Tests instead of Visual Studio Test.

Typical scenarios include:

  • Tests that require additional installations on the test machines, such as different browsers for Selenium tests
  • Coded UI tests
  • Tests that require a specific operating system configuration
  • To execute a large number of unit tests more quickly by using multiple test machines

For more info of the task please refer this blog: Running Automated Test on agent machine using vNext Build

Besides to run Coded UI test, you have to configure the test agent to interact with the Desktop and build agent running as interactive Mode.