2012-02-17 78 views
0

將nunit測試作爲構建過程的一部分運行後。我希望看到該構建的結果。如果我想單擊在VS2010中打開的日誌文件中顯示的查看測試結果鏈接。那麼它首先拋出錯誤說無法連接到服務器,再次點擊將在VS2010的測試結果窗口中顯示重試。但它也沒有顯示任何可以看到結果的TFS網頁中的任何視圖測試結果鏈接。任何想法缺少什麼。單擊構建摘要中的查看測試結果鏈接時無法連接到TFS服務器

4 projects/solutions compiled 
1 test run(s) completed - 0% average pass rate (0% total pass rate) 
0/1 test(s) passed, 1 failed, 0 inconclusive, View Test Results 
No Code Coverage Results 

我改變了構建配置爲NUnit的文件:

     <If Condition="[Not DisableTests]" DisplayName="If Not DisableTests" sap:VirtualizedContainerService.HintSize="1200,1867" mtbwt:BuildTrackingParticipant.Importance="Low"> 
         <If.Then> 
          <Sequence DisplayName="Run Tests" sap:VirtualizedContainerService.HintSize="1075,1761" mtbwt:BuildTrackingParticipant.Importance="Low"> 
          <sap:WorkflowViewStateService.ViewState> 
           <scg:Dictionary x:TypeArguments="x:String, x:Object"> 
           <x:Boolean x:Key="IsExpanded">True</x:Boolean> 
           </scg:Dictionary> 
          </sap:WorkflowViewStateService.ViewState> 
          <If Condition="[Not TestSpecs Is Nothing]" DisplayName="If Not TestSpecs Is Nothing" sap:VirtualizedContainerService.HintSize="1053,1637" mtbwt:BuildTrackingParticipant.Importance="Low"> 
           <If.Then> 
           <ForEach x:TypeArguments="mtbwa:TestSpec" DisplayName="For Each TestSpec in TestSpecs" sap:VirtualizedContainerService.HintSize="928,1531" mtbwt:BuildTrackingParticipant.Importance="Low" Values="[TestSpecs]"> 
            <ActivityAction x:TypeArguments="mtbwa:TestSpec"> 
            <ActivityAction.Argument> 
             <DelegateInArgument x:TypeArguments="mtbwa:TestSpec" Name="spec" /> 
            </ActivityAction.Argument> 
            <TryCatch DisplayName="Try Run Tests" sap:VirtualizedContainerService.HintSize="898,1425" mtbwt:BuildTrackingParticipant.Importance="Low"> 
             <TryCatch.Try> 
             <If Condition="[TypeOf spec Is Microsoft.TeamFoundation.Build.Workflow.Activities.TestMetadataFileSpec]" DisplayName="If spec Is TestMetadataFileSpec" sap:VirtualizedContainerService.HintSize="880,1238" mtbwt:BuildTrackingParticipant.Importance="None"> 
              <If.Then> 
              <Sequence DisplayName="Run MSTest for Metadata File" sap:VirtualizedContainerService.HintSize="222,1132"> 
               <Sequence.Variables> 
               <Variable x:TypeArguments="mtbwa:TestMetadataFileSpec" Name="testMetadataFile" /> 
               <Variable x:TypeArguments="x:String" Name="localTestMetadata" /> 
               </Sequence.Variables> 
               <sap:WorkflowViewStateService.ViewState> 
               <scg:Dictionary x:TypeArguments="x:String, x:Object"> 
                <x:Boolean x:Key="IsExpanded">True</x:Boolean> 
               </scg:Dictionary> 
               </sap:WorkflowViewStateService.ViewState> 
               <Assign x:TypeArguments="mtbwa:TestMetadataFileSpec" DisplayName="Assign spec to testMetadataFile" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" To="[testMetadataFile]" Value="[DirectCast(spec, Microsoft.TeamFoundation.Build.Workflow.Activities.TestMetadataFileSpec)]" /> 
               <mtbwa:ConvertWorkspaceItem DisplayName="Convert Server Path to Local Path" sap:VirtualizedContainerService.HintSize="200,22" mtbwt:BuildTrackingParticipant.Importance="Low" Input="[testMetadataFile.MetadataFileName]" Result="[localTestMetadata]" Workspace="[Workspace]" /> 
               <mtbwa:MSTest Category="[testMetadataFile.CategoryFilter]" CommandLineArguments="[testMetadataFile.MSTestCommandLineArgs]" DisplayName="Run MSTest for Metadata File" Flavor="[platformConfiguration.Configuration]" sap:VirtualizedContainerService.HintSize="200,22" MaxPriority="[testMetadataFile.MaximumPriority]" MinPriority="[testMetadataFile.MinimumPriority]" PathToResultsFilesRoot="[TestResultsDirectory]" Platform="[platformConfiguration.Platform]" SearchPathRoot="[outputDirectory]" TestLists="[testMetadataFile.TestLists]" TestMetadata="[localTestMetadata]" TestSettings="[String.Empty]" /> 
              </Sequence> 
              </If.Then> 
              <If.Else> 
              <Sequence DisplayName="Run NUnit for Test Assemblies" sap:VirtualizedContainerService.HintSize="633,1132" mtbwt:BuildTrackingParticipant.Importance="Low"> 
               <Sequence.Variables> 
               <Variable x:TypeArguments="mtbwa:TestAssemblySpec" Name="testAssembly" /> 
               <Variable x:TypeArguments="scg:IEnumerable(x:String)" Name="testAssemblies" /> 
               <Variable x:TypeArguments="x:String" Default="[String.Empty]" Name="testFlavor" /> 
               <Variable x:TypeArguments="x:String" Default="[String.Empty]" Name="testPlatform" /> 
               <Variable x:TypeArguments="x:Int32" Name="NUnitResult" /> 
               <Variable x:TypeArguments="x:String" Name="variable1" /> 
               </Sequence.Variables> 
               <sap:WorkflowViewStateService.ViewState> 
               <scg:Dictionary x:TypeArguments="x:String, x:Object"> 
                <x:Boolean x:Key="IsExpanded">True</x:Boolean> 
               </scg:Dictionary> 
               </sap:WorkflowViewStateService.ViewState> 
               <Assign x:TypeArguments="mtbwa:TestAssemblySpec" DisplayName="Assign spec to testAssembly" sap:VirtualizedContainerService.HintSize="611,22" mtbwt:BuildTrackingParticipant.Importance="Low" To="[testAssembly]" Value="[DirectCast(spec, Microsoft.TeamFoundation.Build.Workflow.Activities.TestAssemblySpec)]" /> 
               <mtbwa:FindMatchingFiles DisplayName="Find Test Assemblies" sap:VirtualizedContainerService.HintSize="611,22" mtbwt:BuildTrackingParticipant.Importance="Low" MatchPattern="[String.Format(&quot;{0}\{1}&quot;, outputDirectory, testAssembly.AssemblyFileSpec)]" Result="[testAssemblies]" /> 
               <If Condition="[testAssemblies.Count() &gt; 0]" DisplayName="If Test Assemblies Found" sap:VirtualizedContainerService.HintSize="611,884" mtbwt:BuildTrackingParticipant.Importance="Low"> 
               <If.Then> 
                <Sequence DisplayName="Run Tests and Publish Results" sap:VirtualizedContainerService.HintSize="486,778"> 
                <sap:WorkflowViewStateService.ViewState> 
                 <scg:Dictionary x:TypeArguments="x:String, x:Object"> 
                 <x:Boolean x:Key="IsExpanded">True</x:Boolean> 
                 </scg:Dictionary> 
                </sap:WorkflowViewStateService.ViewState> 
                <mtbwa:InvokeProcess Arguments="[String.Format(&quot;/xml:nunit-tests.xml /framework:net-4.0 {0}&quot;, String.Join(&quot; &quot;,&#xD;&#xA;testAssemblies))]" DisplayName="Invoke NUnit" FileName="[System.IO.Path.Combine(NUnitBinaryDirectory, &quot;nunit-console.exe&quot;)]" sap:VirtualizedContainerService.HintSize="464,184" Result="[[NUnitResult]]" WorkingDirectory="[outputDirectory]"> 
                 <mtbwa:InvokeProcess.ErrorDataReceived> 
                 <ActivityAction x:TypeArguments="x:String"> 
                  <ActivityAction.Argument> 
                  <DelegateInArgument x:TypeArguments="x:String" Name="errOutput" /> 
                  </ActivityAction.Argument> 
                 </ActivityAction> 
                 </mtbwa:InvokeProcess.ErrorDataReceived> 
                 <mtbwa:InvokeProcess.OutputDataReceived> 
                 <ActivityAction x:TypeArguments="x:String"> 
                  <ActivityAction.Argument> 
                  <DelegateInArgument x:TypeArguments="x:String" Name="stdOutput" /> 
                  </ActivityAction.Argument> 
                 </ActivityAction> 
                 </mtbwa:InvokeProcess.OutputDataReceived> 
                </mtbwa:InvokeProcess> 
                <mtbwa:InvokeProcess Arguments="[String.Format(&quot;-n {0} -t {1} -p &quot;&quot;{2}&quot;&quot; -f {3} -b &quot;&quot;{4}&quot;&quot; -v 2010&quot;,&#xA;    &quot;nunit-tests.xml&quot;,&#xA;    BuildDetail.TeamProject,&#xA;    BuildSettings.PlatformConfigurations(0).Platform,&#xA;    BuildSettings.PlatformConfigurations(0).Configuration,&#xA;    BuildDetail.BuildNumber)]" DisplayName=" Publish NUnit Results" FileName="[Path.Combine(NUnitTfsPublisherDirectory, &quot;NUnitTfs.exe&quot;)]" sap:VirtualizedContainerService.HintSize="464,184" WorkingDirectory="[outputDirectory]"> 
                 <mtbwa:InvokeProcess.ErrorDataReceived> 
                 <ActivityAction x:TypeArguments="x:String"> 
                  <ActivityAction.Argument> 
                  <DelegateInArgument x:TypeArguments="x:String" Name="errOutput" /> 
                  </ActivityAction.Argument> 
                 </ActivityAction> 
                 </mtbwa:InvokeProcess.ErrorDataReceived> 
                 <mtbwa:InvokeProcess.OutputDataReceived> 
                 <ActivityAction x:TypeArguments="x:String"> 
                  <ActivityAction.Argument> 
                  <DelegateInArgument x:TypeArguments="x:String" Name="stdOutput" /> 
                  </ActivityAction.Argument> 
                 </ActivityAction> 
                 </mtbwa:InvokeProcess.OutputDataReceived> 
                </mtbwa:InvokeProcess> 
                <If Condition="[NUnitResult &lt;&gt; 0]" DisplayName="If NUnit Tests Failed" sap:VirtualizedContainerService.HintSize="464,206"> 
                 <If.Then> 
                 <Assign DisplayName="Set Test Status To Failed" sap:VirtualizedContainerService.HintSize="291,100"> 
                  <Assign.To> 
                  <OutArgument x:TypeArguments="mtbc:BuildPhaseStatus">[BuildDetail.TestStatus]</OutArgument> 
                  </Assign.To> 
                  <Assign.Value> 
                  <InArgument x:TypeArguments="mtbc:BuildPhaseStatus">[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Failed]</InArgument> 
                  </Assign.Value> 
                 </Assign> 
                 </If.Then> 
                </If> 
                </Sequence> 
               </If.Then> 
               </If> 
              </Sequence> 
              </If.Else> 
             </If> 

回答

0

查看在Web Access中的測試結果並沒有對DEV10實現,也不是協議處理程序在Visual打開測試結果文件(TRX)工作室。這解釋了爲什麼構建摘要不顯示TFS網頁上的「查看測試結果」鏈接。

根據Visual Studio的問題,當您第一次點擊VS中的「查看測試結果」時,它是否總是拋出「無法連接到服務器」錯誤?當你說「再次點擊」時,你的意思是再次點擊「查看測試結果」?你能檢查事件日誌,看看是否有任何相關的錯誤與更多的信息。