11package org .utplsql .api ;
22
3+ import org .slf4j .Logger ;
4+ import org .slf4j .LoggerFactory ;
35import org .utplsql .api .compatibility .CompatibilityProxy ;
46import org .utplsql .api .db .DatabaseInformation ;
57import org .utplsql .api .db .DefaultDatabaseInformation ;
2426 */
2527public class TestRunner {
2628
29+ private static final Logger logger = LoggerFactory .getLogger (TestRunner .class );
30+
2731 private final TestRunnerOptions options = new TestRunnerOptions ();
2832 private CompatibilityProxy compatibilityProxy ;
2933 private ReporterFactory reporterFactory ;
@@ -122,9 +126,13 @@ private void delayedAddReporters() {
122126
123127 public void run (Connection conn ) throws SQLException {
124128
129+ logger .info ("TestRunner initialized" );
130+
125131 DatabaseInformation databaseInformation = new DefaultDatabaseInformation ();
126132
127133 compatibilityProxy = new CompatibilityProxy (conn , options .skipCompatibilityCheck , databaseInformation );
134+ logger .info ("Running on utPLSQL {}" , compatibilityProxy .getDatabaseVersion ());
135+
128136 if ( reporterFactory == null )
129137 reporterFactory = ReporterFactory .createDefault (compatibilityProxy );
130138
@@ -133,6 +141,7 @@ public void run(Connection conn) throws SQLException {
133141 // First of all check version compatibility
134142 compatibilityProxy .failOnNotCompatible ();
135143
144+ logger .info ("Initializing reporters" );
136145 for (Reporter r : options .reporterList )
137146 validateReporter (conn , r );
138147
@@ -141,12 +150,14 @@ public void run(Connection conn) throws SQLException {
141150 }
142151
143152 if (options .reporterList .isEmpty ()) {
153+ logger .info ("No reporter given so choosing ut_documentation_reporter" );
144154 options .reporterList .add (new DocumentationReporter ().init (conn ));
145155 }
146156
147- DBHelper .enableDBMSOutput (conn );
148157 try (TestRunnerStatement testRunnerStatement = compatibilityProxy .getTestRunnerStatement (options , conn )) {
158+ logger .info ("Running tests" );
149159 testRunnerStatement .execute ();
160+ logger .info ("Running tests finished." );
150161 } catch (SQLException e ) {
151162 if (e .getErrorCode () == SomeTestsFailedException .ERROR_CODE ) {
152163 throw new SomeTestsFailedException (e .getMessage (), e );
@@ -157,8 +168,6 @@ else if (e.getErrorCode() == UtPLSQLNotInstalledException.ERROR_CODE) {
157168 else {
158169 throw e ;
159170 }
160- } finally {
161- DBHelper .disableDBMSOutput (conn );
162171 }
163172 }
164173
0 commit comments