2017-04-18 18 views
1

當我試圖運行一個簡單的編碼UI測試項目時使用一種測試方法(它驗證「加上」使用Team Foundation Server的2015年(更新4),我發現了在測試執行的步驟以下錯誤的Windows計算器應用程序的功能) -錯誤「您必須設置測試代理作爲交互式進程運行」,同時運行TFS 2015的編碼UI測試構建過程

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() 

設置/環境細節: 操作系統:Windows Server 2012標準(64位操作系統,基於x64的處理器) VS:更新3的Visual Studio Enterprise 2015 TFS:更新4的Team Foundation Server 2015

構建定義(構建步驟)[NOT XAML定義]:使用

enter image description here

enter image description here

enter image description here

運行設置文件:

<?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> 

我錯過任何上面的步驟?請幫我解決構建失敗問題。

在此先感謝!

問候,

阿燕

+0

您是否有測試代理來運行測試或僅使用構建代理來運行測試? –

回答

1

您使用了錯誤的任務。您需要使用Run Functional Tests而不是Visual Studio Test。

典型場景包括:要求在測試機器其他安裝

  • 試驗,如不同的瀏覽器爲硒測試
  • 編碼的UI測試
  • 試驗需要一特定的操作系統配置
  • 要執行大量的單元測試更多qui ckly通過使用多個試驗機

對於任務的詳細信息,請參閱本博客:Running Automated Test on agent machine using vNext Build

除了運行編碼的UI測試,你必須配置測試代理互動與桌面和構建代理以交互式模式運行。

+0

非常感謝您幫助我!有了上述鏈接和https://github.com/Microsoft/vsts-tasks/issues/2965(對於另一個錯誤),我能夠成功運行編碼UI測試。 – Ayan

+0

@ PatrickLu-MSFT:有沒有什麼辦法可以在不使用'Interactive'代理的情況下運行編碼的UI測試,而是作爲VSO的一部分?我處於Agent Pool管理員不允許設置已啓用自動登錄並禁用屏幕鎖定的座席的情況。 –

相關問題