@@ -67,56 +67,58 @@ public async Task RunTestsAsync(string type, string owner, string name, string p
6767 try
6868 {
6969 testRunner . GetVersion ( ) ;
70- Running = true ;
71-
72- if ( coverage )
73- {
74- var codeCoverageReportDialog = new CodeCoverageReportDialog ( GetPath ( type , owner , name , procedure ) ) ;
75- var dialogResult = codeCoverageReportDialog . ShowDialog ( ) ;
76- if ( dialogResult == DialogResult . OK )
77- {
78- txtStatus . Text = "Running tests with coverage..." ;
79-
80- Show ( ) ;
70+ }
71+ catch
72+ {
73+ MessageBox . Show ( "utPLSQL is not installed" , "utPLSQL not installed" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
74+ return ;
75+ }
8176
82- var schemas = ConvertToList ( codeCoverageReportDialog . GetSchemas ( ) ) ;
83- var includes = ConvertToList ( codeCoverageReportDialog . GetIncludes ( ) ) ;
84- var excludes = ConvertToList ( codeCoverageReportDialog . GetExcludes ( ) ) ;
77+ Running = true ;
8578
86- completedTests = 0 ;
79+ if ( coverage )
80+ {
81+ var codeCoverageReportDialog = new CodeCoverageReportDialog ( GetPath ( type , owner , name , procedure ) ) ;
82+ var dialogResult = codeCoverageReportDialog . ShowDialog ( ) ;
83+ if ( dialogResult == DialogResult . OK )
84+ {
85+ Show ( ) ;
8786
88- var htmlReport = await testRunner . RunTestsWithCoverageAsync ( GetPath ( type , owner , name , procedure ) , CollectResults ( coverage ) , schemas , includes , excludes ) ;
87+ var schemas = ConvertToList ( codeCoverageReportDialog . GetSchemas ( ) ) ;
88+ var includes = ConvertToList ( codeCoverageReportDialog . GetIncludes ( ) ) ;
89+ var excludes = ConvertToList ( codeCoverageReportDialog . GetExcludes ( ) ) ;
8990
90- var filePath = $ "{ Path . GetTempPath ( ) } \\ utPLSQL_Coverage_Report_{ Guid . NewGuid ( ) } .html";
91- using ( var sw = new StreamWriter ( filePath ) )
92- {
93- sw . WriteLine ( htmlReport ) ;
94- }
91+ completedTests = 0 ;
9592
96- txtStatus . BeginInvoke ( ( MethodInvoker ) delegate
97- {
98- txtStatus . Text = totalNumberOfTests > 0 ? "Finished" : "No tests found" ;
99- } ) ;
93+ txtStatus . Text = "Running tests with coverage..." ;
10094
101- Running = false ;
95+ var htmlReport = await testRunner . RunTestsWithCoverageAsync ( GetPath ( type , owner , name , procedure ) , CollectResults ( coverage ) , schemas , includes , excludes ) ;
10296
103- System . Diagnostics . Process . Start ( filePath ) ;
97+ var filePath = $ "{ Path . GetTempPath ( ) } \\ utPLSQL_Coverage_Report_{ Guid . NewGuid ( ) } .html";
98+ using ( var sw = new StreamWriter ( filePath ) )
99+ {
100+ sw . WriteLine ( htmlReport ) ;
104101 }
105- }
106- else
107- {
108- txtStatus . Text = "Running tests..." ;
109102
110- Show ( ) ;
103+ txtStatus . BeginInvoke ( ( MethodInvoker ) delegate
104+ {
105+ txtStatus . Text = totalNumberOfTests > 0 ? "Finished" : "No tests found" ;
106+ } ) ;
111107
112- completedTests = 0 ;
108+ Running = false ;
113109
114- await testRunner . RunTestsAsync ( GetPath ( type , owner , name , procedure ) , CollectResults ( coverage ) ) ;
110+ System . Diagnostics . Process . Start ( filePath ) ;
115111 }
116112 }
117- catch
113+ else
118114 {
119- MessageBox . Show ( "utPLSQL is not installed" , "utPLSQL not installed" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
115+ Show ( ) ;
116+
117+ completedTests = 0 ;
118+
119+ txtStatus . Text = "Running tests..." ;
120+
121+ await testRunner . RunTestsAsync ( GetPath ( type , owner , name , procedure ) , CollectResults ( coverage ) ) ;
120122 }
121123 }
122124
@@ -128,6 +130,8 @@ private Action<@event> CollectResults(bool coverage)
128130 {
129131 gridResults . BeginInvoke ( ( MethodInvoker ) delegate
130132 {
133+ txtStatus . Text = "Running tests..." ;
134+
131135 totalNumberOfTests = @event . totalNumberOfTests ;
132136
133137 progressBar . Minimum = 0 ;
@@ -476,7 +480,9 @@ private void TestResultWindow_FormClosing(object sender, FormClosingEventArgs e)
476480 else
477481 {
478482 txtStatus . Text = "Aborting..." ;
483+
479484 testRunner . Close ( ) ;
485+
480486 Running = false ;
481487 }
482488 }
0 commit comments