2011-12-22 11 views
2

私はTFSにインポートされたばかりのJavaプロジェクトを持っていますが、単体テストの結果を出力するためにTFSを取得しようとしています。 TFSBuild.projファイルの終わりにTFSがAnt/JUnitビルドから単体テスト結果を見つけることができません

私は、次があります。

<ItemGroup> 
    <!-- Ant Call Configuration. 
     The build file called should be included in the workspace of the build definition. 
    --> 

    <AntBuildFile Include="$/PROJECT_NAME/Main/tfsbuild.xml"> 
    <Targets>build,test</Targets> 
    <Properties>BinariesRoot=$(BinariesRoot);BuildDefinitionName=$(BuildDefinitionName);BuildDefinitionUri=$(BuildDefinitionUri);BuildDirectory=$(BuildDirectory);BuildNumber=$(BuildNumber);DropLocation=$(DropLocation);LogLocation=$(LogLocation);SourceGetVersion=$(SourceGetVersion);TestResultsRoot=$(TestResultsRoot);TeamProject=$(TeamProject);WorkspaceName=$(WorkspaceName);WorkspaceOwner=$(WorkspaceOwner)</Properties> 
    <Lib></Lib> 
    </AntBuildFile> 

    <!-- JUnit XML Results files should be created using the XML formatter 
     and be located in the following path 
    --> 
    <JUnitLogFiles Include="$(BinariesRoot)\**\TEST-*.xml" /> 
</ItemGroup> 

これはビルドをキックオフし、どこJUnitテスト結果を見つけるためにTFSを伝えます。 問題は、テストが実行されたことをログで確認できても、TFSは単体テスト結果を見つけられません。

答えて

2

私はほとんどこれをあきらめて、私のantファイルを変更してjunitレポートを作成し、それをビルドアーティファクトと共に保存しました。私はあることを私のAntタスクを変更:

<target name="test" depends="compile-tests"> 
    <echo>Running unit tests, output should be in ${junit.output}</echo> 
    <junit printsummary="yes"> 
     <classpath> 
      <pathelement path="${compile.classpath}" /> 
      <pathelement path="${lib.dir}/junit-4.0.jar" /> 
      <pathelement path="${build}" /> 
      <pathelement path="${dist-classes}" /> 
     </classpath> 

     <formatter type="xml" /> 

     <batchtest fork="yes" todir="${junit.output}"> 
      <fileset dir="${src.test}"> 
       <include name="**/*Test.java" /> 
      </fileset> 
     </batchtest> 
    </junit> 

    <mkdir dir="${DropLocation}/${BuildNumber}/test_results" /> 
    <junitreport todir="${junit.output}"> 
     <fileset dir="${junit.output}"> 
      <include name="TEST-*.xml" /> 
     </fileset> 
     <report todir="${DropLocation}/${BuildNumber}/test_results" /> 
    </junitreport> 
</target> 

しかし、次のビルドからの出力をチェックした後、私はJUnitの出力がTESTS-TestSuites.xml、ない TESTとして保存されたことを実現 - * XML。それに応じてTFSBuild.projファイルを変更し、ビルド結果をTFSに表示させるようにしました。

どういうわけか、junitreportタスクがまだ出力をピックアップしています。

関連する問題