1
1
using System . ComponentModel ;
2
+ using System . Drawing ;
2
3
using System . Threading ;
3
4
using System . Windows . Forms ;
4
5
using utPLSQL ;
@@ -9,6 +10,7 @@ public partial class RealTimeTestResultWindow : Form
9
10
{
10
11
private readonly RealTimeTestRunner testRunner ;
11
12
private BindingList < TestResult > testResults = new BindingList < TestResult > ( ) ;
13
+ private int totalNumberOfTests ;
12
14
13
15
public RealTimeTestResultWindow ( RealTimeTestRunner testRunner )
14
16
{
@@ -20,21 +22,22 @@ public RealTimeTestResultWindow(RealTimeTestRunner testRunner)
20
22
gridResults . DataSource = bindingSource ;
21
23
22
24
gridResults . Columns [ 0 ] . MinimumWidth = 50 ;
23
- gridResults . Columns [ 1 ] . MinimumWidth = 422 ;
25
+ gridResults . Columns [ 1 ] . MinimumWidth = 424 ;
24
26
gridResults . Columns [ 2 ] . MinimumWidth = 50 ;
25
27
gridResults . Columns [ 3 ] . MinimumWidth = 440 ;
26
28
}
27
29
28
30
internal void RunTests ( string type , string owner , string name , string subType )
29
31
{
30
- lblStatus . Text = "" ;
31
-
32
32
txtTests . Text = "" ;
33
33
txtFailures . Text = "" ;
34
34
txtErrors . Text = "" ;
35
35
txtDisabled . Text = "" ;
36
+ txtStatus . Text = "" ;
36
37
txtTime . Text = "" ;
37
38
39
+ txtBar . BackColor = Control . DefaultBackColor ;
40
+
38
41
testResults . Clear ( ) ;
39
42
40
43
if ( WindowState == FormWindowState . Minimized )
@@ -45,30 +48,45 @@ internal void RunTests(string type, string owner, string name, string subType)
45
48
46
49
new Thread ( ( ) =>
47
50
{
51
+ var completetedTests = 0 ;
52
+
48
53
testRunner . RunTests ( type , owner , name , subType ) ;
49
54
testRunner . ConsumeResult ( @event =>
50
55
{
51
56
gridResults . BeginInvoke ( ( MethodInvoker ) delegate ( )
52
57
{
53
58
if ( @event . type . Equals ( "pre-run" ) )
54
59
{
55
- lblStatus . Text = "Running..." ;
60
+ txtStatus . Text = "Running..." ;
56
61
62
+ totalNumberOfTests = @event . totalNumberOfTests ;
57
63
CreateTestResults ( @event ) ;
58
64
}
59
65
else if ( @event . type . Equals ( "post-test" ) )
60
66
{
61
67
UpdateTestResult ( @event ) ;
68
+
69
+ completetedTests ++ ;
70
+ txtTests . Text = ( completetedTests > totalNumberOfTests ? totalNumberOfTests : completetedTests ) + "/" + totalNumberOfTests ;
62
71
}
63
72
else if ( @event . type . Equals ( "post-run" ) )
64
73
{
65
- lblStatus . Text = "Finished" ;
66
-
67
- txtTests . Text = "" + ( @event . run . counter . disabled + @event . run . counter . success + @event . run . counter . failure + @event . run . counter . error + @event . run . counter . warning ) ;
68
- txtFailures . Text = "" + @event . run . counter . failure ;
69
- txtErrors . Text = "" + @event . run . counter . error ;
70
- txtDisabled . Text = "" + @event . run . counter . disabled ;
71
- txtTime . Text = "" + @event . run . executionTime ;
74
+ txtStatus . Text = "Finished" ;
75
+
76
+ txtTests . Text = ( completetedTests > totalNumberOfTests ? totalNumberOfTests : completetedTests ) + "/" + totalNumberOfTests ;
77
+ txtFailures . Text = @event . run . counter . failure + "" ;
78
+ txtErrors . Text = @event . run . counter . error + "" ;
79
+ txtDisabled . Text = @event . run . counter . disabled + "" ;
80
+ txtTime . Text = @event . run . executionTime + "" ;
81
+
82
+ if ( @event . run . counter . failure == 0 && @event . run . counter . error == 0 )
83
+ {
84
+ txtBar . BackColor = Color . Green ;
85
+ }
86
+ else
87
+ {
88
+ txtBar . BackColor = Color . DarkRed ;
89
+ }
72
90
73
91
}
74
92
} ) ;
0 commit comments