@@ -9,7 +9,7 @@ namespace XUnitWrapperLibrary;
99
1010public class TestSummary
1111{
12- readonly record struct TestResult ( string Name , string ContainingTypeName , string MethodName , TimeSpan Duration , Exception ? Exception , string ? SkipReason ) ;
12+ readonly record struct TestResult ( string Name , string ContainingTypeName , string MethodName , TimeSpan Duration , Exception ? Exception , string ? SkipReason , string ? Output ) ;
1313
1414 public int PassedTests { get ; private set ; } = 0 ;
1515 public int FailedTests { get ; private set ; } = 0 ;
@@ -19,22 +19,22 @@ public class TestSummary
1919
2020 private DateTime _testRunStart = DateTime . Now ;
2121
22- public void ReportPassedTest ( string name , string containingTypeName , string methodName , TimeSpan duration )
22+ public void ReportPassedTest ( string name , string containingTypeName , string methodName , TimeSpan duration , string output )
2323 {
2424 PassedTests ++ ;
25- _testResults . Add ( new TestResult ( name , containingTypeName , methodName , duration , null , null ) ) ;
25+ _testResults . Add ( new TestResult ( name , containingTypeName , methodName , duration , null , null , output ) ) ;
2626 }
2727
28- public void ReportFailedTest ( string name , string containingTypeName , string methodName , TimeSpan duration , Exception ex )
28+ public void ReportFailedTest ( string name , string containingTypeName , string methodName , TimeSpan duration , Exception ex , string output )
2929 {
3030 FailedTests ++ ;
31- _testResults . Add ( new TestResult ( name , containingTypeName , methodName , duration , ex , null ) ) ;
31+ _testResults . Add ( new TestResult ( name , containingTypeName , methodName , duration , ex , null , output ) ) ;
3232 }
3333
3434 public void ReportSkippedTest ( string name , string containingTypeName , string methodName , TimeSpan duration , string reason )
3535 {
3636 SkippedTests ++ ;
37- _testResults . Add ( new TestResult ( name , containingTypeName , methodName , duration , null , reason ) ) ;
37+ _testResults . Add ( new TestResult ( name , containingTypeName , methodName , duration , null , reason , null ) ) ;
3838 }
3939
4040 public string GetTestResultOutput ( string assemblyName )
@@ -72,15 +72,15 @@ public string GetTestResultOutput(string assemblyName)
7272 resultsFile . Append ( $@ "<test name=""{ test . Name } "" type=""{ test . ContainingTypeName } "" method=""{ test . MethodName } "" time=""{ test . Duration . TotalSeconds : F6} "" ") ;
7373 if ( test . Exception is not null )
7474 {
75- resultsFile . AppendLine ( $@ "result=""Fail""><failure exception-type=""{ test . Exception . GetType ( ) } ""><message><![CDATA[{ test . Exception . Message } ]]></message><stack-trace><![CDATA[{ test . Exception . StackTrace } ]]></stack-trace></failure></test>") ;
75+ resultsFile . AppendLine ( $@ "result=""Fail""><failure exception-type=""{ test . Exception . GetType ( ) } ""><message><![CDATA[{ test . Exception . Message } ]]></message><stack-trace><![CDATA[{ test . Exception . StackTrace } ]]></stack-trace></failure><output><![CDATA[ { test . Output } ]]></output>< /test>") ;
7676 }
7777 else if ( test . SkipReason is not null )
7878 {
7979 resultsFile . AppendLine ( $@ "result=""Skip""><reason><![CDATA[{ test . SkipReason } ]]></reason></test>") ;
8080 }
8181 else
8282 {
83- resultsFile . AppendLine ( @" result=""Pass"" / >" ) ;
83+ resultsFile . AppendLine ( $ @ " result=""Pass""><output><![CDATA[ { test . Output } ]]></output></test >") ;
8484 }
8585 }
8686
0 commit comments