@@ -66,7 +66,7 @@ public static string CreateCombinedTestSummaryReport(string basePath)
6666 ? "lin"
6767 : filePath . Contains ( "macos-" )
6868 ? "mac"
69- : "os?" ;
69+ : throw new InvalidOperationException ( $ "Could not determine OS from file path: { filePath } " ) ;
7070
7171 tableBuilder . AppendLine ( CultureInfo . InvariantCulture , $ "| { ( failed > 0 ? "❌" : "✅" ) } [{ os } ] { GetTestTitle ( filePath ) } | { passed } | { failed } | { skipped } | { total } |") ;
7272 }
@@ -84,7 +84,7 @@ public static string CreateCombinedTestSummaryReport(string basePath)
8484 return overallTableBuilder . ToString ( ) ;
8585 }
8686
87- public static void CreateSingleTestSummaryReport ( string trxFilePath , StringBuilder reportBuilder , string ? url = null )
87+ public static void CreateSingleTestSummaryReport ( string trxFilePath , StringBuilder reportBuilder , string ? url )
8888 {
8989 if ( ! File . Exists ( trxFilePath ) )
9090 {
@@ -109,21 +109,27 @@ public static void CreateSingleTestSummaryReport(string trxFilePath, StringBuild
109109 var failed = counters . Failed ;
110110 if ( failed == 0 )
111111 {
112+ Console . WriteLine ( $ "No failed tests in { trxFilePath } ") ;
112113 return ;
113114 }
114115
115116 var total = counters . Total ;
116117 var passed = counters . Passed ;
117118 var skipped = counters . NotExecuted ;
118119
119- reportBuilder . AppendLine ( CultureInfo . InvariantCulture , $ "### { GetTestTitle ( trxFilePath ) } ") ;
120+ var title = string . IsNullOrEmpty ( url )
121+ ? GetTestTitle ( trxFilePath )
122+ : $ "{ GetTestTitle ( trxFilePath ) } (<a href=\" { url } \" >Logs</a>)";
123+
124+ reportBuilder . AppendLine ( CultureInfo . InvariantCulture , $ "### { title } ") ;
120125 reportBuilder . AppendLine ( "| Passed | Failed | Skipped | Total |" ) ;
121126 reportBuilder . AppendLine ( "|--------|--------|---------|-------|" ) ;
122127 reportBuilder . AppendLine ( CultureInfo . InvariantCulture , $ "| { passed } | { failed } | { skipped } | { total } |") ;
123128
124129 reportBuilder . AppendLine ( ) ;
125130 if ( testRun . Results ? . UnitTestResults is null )
126131 {
132+ Console . WriteLine ( $ "Could not find any UnitTestResult entries in { trxFilePath } ") ;
127133 return ;
128134 }
129135
@@ -132,18 +138,20 @@ public static void CreateSingleTestSummaryReport(string trxFilePath, StringBuild
132138 {
133139 foreach ( var test in failedTests )
134140 {
135- var title = string . IsNullOrEmpty ( url )
136- ? $ "🔴 <b>{ test . TestName } </b>"
137- : $ "🔴 <a href=\" { url } \" >{ test . TestName } </a>";
138-
139141 reportBuilder . AppendLine ( "<div>" ) ;
140142 reportBuilder . AppendLine ( CultureInfo . InvariantCulture , $ """
141- <details><summary>{ title } </summary>
143+ <details><summary>🔴 <b>{ test . TestName } </b></summary>
144+
142145 """ ) ;
143146
144147 var errorMsgBuilder = new StringBuilder ( ) ;
145148 errorMsgBuilder . AppendLine ( test . Output ? . ErrorInfo ? . InnerText ?? string . Empty ) ;
146- errorMsgBuilder . AppendLine ( test . Output ? . StdOut ?? string . Empty ) ;
149+ if ( test . Output ? . StdOut is not null )
150+ {
151+ errorMsgBuilder . AppendLine ( ) ;
152+ errorMsgBuilder . AppendLine ( "### StdOut" ) ;
153+ errorMsgBuilder . AppendLine ( test . Output . StdOut ) ;
154+ }
147155
148156 // Truncate long error messages for readability
149157 var errorMsgTruncated = TruncateTheStart ( errorMsgBuilder . ToString ( ) , 50_000 ) ;
0 commit comments