1- using Cake . Common . Build . AzurePipelines . Data ;
21using Cake . Common . Tools . DotNet . Test ;
3- using Cake . Coverlet ;
42using Cake . Incubator . LoggingExtensions ;
53using Common . Utilities ;
64
@@ -49,24 +47,10 @@ public override void OnError(Exception exception, BuildContext context)
4947 throw exception ;
5048 }
5149
52- public override void Finally ( BuildContext context )
53- {
54- var testResultsFiles = context . GetFiles ( $ "{ Paths . TestOutput } /*.results.xml") ;
55- if ( ! context . IsAzurePipelineBuild || testResultsFiles . Count == 0 ) return ;
56-
57- var data = new AzurePipelinesPublishTestResultsData
58- {
59- TestResultsFiles = testResultsFiles . ToArray ( ) ,
60- Platform = context . Platform . ToString ( ) ,
61- TestRunner = AzurePipelinesTestRunnerType . JUnit
62- } ;
63- context . BuildSystem ( ) . AzurePipelines . Commands . PublishTestResults ( data ) ;
64- }
65-
6650 private static void TestProjectForTarget ( BuildContext context , FilePath project , string framework )
6751 {
6852 var testResultsPath = Paths . TestOutput ;
69- var projectName = $ "{ project . GetFilenameWithoutExtension ( ) } .net { framework } ";
53+ var projectName = $ "{ project . GetFilenameWithoutExtension ( ) } ";
7054 var settings = new DotNetTestSettings
7155 {
7256 PathType = DotNetTestPathType . Project ,
@@ -78,14 +62,16 @@ private static void TestProjectForTarget(BuildContext context, FilePath project,
7862 } ;
7963 settings . MSBuildSettings . SetContinuousIntegrationBuild ( false ) ;
8064
81- var resultsPath = context . MakeAbsolute ( testResultsPath . CombineWithFilePath ( $ "{ projectName } .results.xml") ) ;
65+ var resultsDirectory = context . MakeAbsolute ( testResultsPath . Combine ( projectName ) ) ;
66+
8267 settings . WithArgumentCustomization ( args => args
8368 . Append ( "--report-spekt-junit" )
84- . Append ( "--report-spekt-junit-filename" ) . AppendQuoted ( resultsPath . FullPath )
69+ . Append ( "--report-spekt-junit-filename" ) . AppendQuoted ( resultsDirectory . CombineWithFilePath ( "results.xml" ) . FullPath )
70+ . Append ( "--results-directory" ) . AppendQuoted ( resultsDirectory . FullPath )
8571 . Append ( "--coverlet" )
8672 . Append ( "--coverlet-output-format" ) . AppendQuoted ( "cobertura" )
87- . Append ( "--coverlet-exclude " ) . AppendQuoted ( "[GitVersion*.Tests]*" )
88- . Append ( "--coverlet-exclude " ) . AppendQuoted ( "[GitTools .Testing]*" )
73+ . Append ( "--coverlet-exclude" ) . AppendQuoted ( "[GitVersion*.Tests]*" )
74+ . Append ( "--coverlet-exclude" ) . AppendQuoted ( "[GitVersion .Testing]*" )
8975 ) ;
9076
9177 context . DotNetTest ( project . FullPath , settings ) ;
0 commit comments