@@ -27,7 +27,7 @@ public class TestRunner : EditorPlugin
2727 Version = new Version ( 1 , 1 ) ,
2828 RepositoryUrl = "https://github.com/FlaxCommunityProjects/FlaxUnitTesting"
2929 } ;
30-
30+
3131 public override void InitializeEditor ( )
3232 {
3333 base . InitializeEditor ( ) ;
@@ -94,16 +94,23 @@ public static void RunTests()
9494 catch ( TargetInvocationException e )
9595 {
9696 if ( ! ( e . InnerException is SuccessException ) )
97+ {
9798 failed = true ;
98- }
99- catch ( Exception e )
100- {
101- failed = true ;
99+ Debug . LogException ( e . InnerException ) ;
100+ }
102101 }
103102 finally
104103 {
105104 afterEach ? . Invoke ( instance , null ) ;
106- Debug . Log ( $ "Test '{ suite . Name } { testMethod . Name } ' finished with " + ( failed ? "Error" : "Success" ) ) ;
105+ string message = $ "Test '{ suite . Name } { testMethod . Name } ' finished with " + ( failed ? "Error" : "Success" ) ;
106+ if ( failed )
107+ {
108+ Debug . LogError ( message ) ;
109+ }
110+ else
111+ {
112+ Debug . Log ( message ) ;
113+ }
107114 }
108115 }
109116 else
@@ -123,11 +130,9 @@ public static void RunTests()
123130 catch ( TargetInvocationException e )
124131 {
125132 if ( ! ( e . InnerException is SuccessException ) )
133+ {
126134 failed = true ;
127- }
128- catch ( Exception e )
129- {
130- failed = true ;
135+ }
131136 }
132137 finally
133138 {
@@ -138,7 +143,16 @@ public static void RunTests()
138143 }
139144 }
140145
141- Debug . Log ( $ "Test '{ suite . Name } { testMethod . Name } ' finished with { successCount } /{ testCases . Count ( ) } successfull test cases.") ;
146+ int testCount = testCases . Count ( ) ;
147+ string message = $ "Test '{ suite . Name } { testMethod . Name } ' finished with { successCount } /{ testCount } successfull test cases.";
148+ if ( successCount < testCount )
149+ {
150+ Debug . LogError ( message ) ;
151+ }
152+ else
153+ {
154+ Debug . Log ( message ) ;
155+ }
142156 }
143157 }
144158
0 commit comments