2015-08-20 51 views
1

我正在與TFS BuildServer + TestControler +多個TestAgent進行集成環境。有沒有辦法在* .runsettings文件中加入'Remote Controller name'?

此前我使用* .testsettings文件並在角色下定義遠程服務器。

我將BuildServer更新爲VS2013,並引入了SpecRun以進行測試執行。

由於我有一個TFS自定義* .srprofile文件,我不得不使用.runsettings文件而不是.testsettings文件。

我找不到標籤,我可以在.runsettings文件中定義「遠程控制器名稱」。

有沒有辦法在* .runsettings文件中包含'Remote Controller name'?

我對構建配置非常陌生。任何洞察力高度讚賞。

其他細節:

我發現this文章和定義的.runsettings文件中的.testsettings文件路徑。以下是根據文章更改的文件。 但它不工作。 可能是SpecRun適配器不支持標籤。

我使用的TestSettings文件。

<?xml version="1.0" encoding="UTF-8"?> 
<TestSettings name=".........." id="........." xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> 
    <Description>Remote settings for running the tests on.....</Description> 
    <Deployment> 
    .... 
    </Deployment> 
    <RemoteController name=".....local:6901" /> 
    <Execution location="Remote"> 
    <TestTypeSpecific> 
     <UnitTestRunConfig testTypeId="....."> 
     <AssemblyResolution> 
      <TestDirectory useLoadContext="true" /> 
     </AssemblyResolution> 
     </UnitTestRunConfig> 
    </TestTypeSpecific> 
    <AgentRule name="....."> 
    </AgentRule> 
    </Execution> 
    <Properties /> 
</TestSettings> 

樣品* .runsettings文件我現在使用。

<?xml version="1.0" encoding="utf-8"?> 
<RunSettings> 
    <!-- Configurations that affect the Test Framework --> 
    <RunConfiguration> 
    <!-- Path relative to solution directory --> 
    <ResultsDirectory>......</ResultsDirectory> 
    </RunConfiguration> 

    <SpecRun> 
    <Profile>TFS.srprofile</Profile> 
    <ReportFile>TestResults.html</ReportFile> 
    <GenerateSpecRunTrait>true</GenerateSpecRunTrait> 
    <GenerateFeatureTrait>false</GenerateFeatureTrait> 
    <SettingsFile>.....\Remote.AutoTest_2013.testsettings</SettingsFile> 
    <ForcedLegacyMode>true</ForcedLegacyMode> 
    </SpecRun> 
</RunSettings> 
+0

嗨,我試圖做同樣的事情,但我不相信這是可能的。如果您閱讀此https://msdn.microsoft.com/en-us/library/ms182486.aspx,則表示mstest.exe可以使用控制器,但沒有提及vstest,它使用runsettings文件。看起來好像不太可能在控制器/代理配置中使用vstest,我還沒有找到替代方案。 –

+0

我有相同的研究成果。如果您找到任何替代方法,請提供足夠的信息告訴我。我很想知道。謝謝.. –

回答

0

OK,我想你犯的錯誤是使用runsettings文件。您可以在testsettings文件中指定它。我們是這樣的:

<?xml version="1.0" encoding="UTF-8"?> 
<TestSettings name="RemoteTest" id="9cfa5873-0238-4d56-a1ec-079192fa72c8" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> 
    <Description>Settings set up to run remotely through test controller</Description> 
    <RemoteController name="**YOURCONTROLLERMACHINE**" /> 
    <Execution location="Remote" hostProcessPlatform="MSIL"> 
    <TestTypeSpecific> 
     <UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b"> 
     <AssemblyResolution> 
      <TestDirectory useLoadContext="true" /> 
     </AssemblyResolution> 
     </UnitTestRunConfig> 
    </TestTypeSpecific> 
    <AgentRule name="AllAgentsDefaultRole"> 
    </AgentRule> 
    </Execution> 
    <Properties /> 
</TestSettings> 

然後,您可以從命令行調用該方法,傳入testsettings路徑:

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "C:\blahblah\TestsAssembly.dll" /Logger:trx /settings:C:\DummyTests\Remote.testsettings /Platform:x64 

哪裏TestsAssembly.dll包含您要運行的測試,並Remote.testsettings如上所述。生成的.trx文件出現在\ TestResults中...

根本不需要runsettings文件。

+0

請,請分享你如何做到這一點。我很失落,感謝很多先進的人。 –

+0

這對Anjana有幫助嗎? –

相關問題