]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.testing/src/org/simantics/db/testing/base/SCLScriptTestBase.java
Log test name before and after execution with timeout and exec time
[simantics/platform.git] / bundles / org.simantics.db.testing / src / org / simantics / db / testing / base / SCLScriptTestBase.java
index 1ea9e6a546d0e77a6469e4bef55d69478e2adeb3..459be8d4a62228c70c52430c143c0459242706db 100644 (file)
@@ -81,8 +81,10 @@ public class SCLScriptTestBase extends FreshDatabaseTest {
 
         String testName = resolveTestName();
         TestRunnable runnable = testRunnables.get(testName);
+        long start = System.nanoTime(); 
 
         if (timeout > -1) {
+            LOGGER.info("Running test {} with a timeout of {} seconds", testName, timeout); //$NON-NLS-1$
             Timer timer = new Timer();
             timer.schedule(new TimerTask() {
 
@@ -104,14 +106,19 @@ public class SCLScriptTestBase extends FreshDatabaseTest {
             }, timeout*1000);
             try {
                 runnable.run();
+                long end = System.nanoTime();
+                LOGGER.info("Completed test {} execution in {} seconds", testName, String.format("%.3f", (end-start)*1e-9)); //$NON-NLS-1$
             } catch (Exception e) {
                 LOGGER.error("Failed to run test {} runnable {}", testName, runnable, e);
             } finally {
                 timer.cancel();
             }
         } else {
+            LOGGER.info("Running test {} without timeout", testName); //$NON-NLS-1$
             try {
                 runnable.run();
+                long end = System.nanoTime();
+                LOGGER.info("Completed test {} execution in {} seconds", testName, String.format("%.3f", (end-start)*1e-9)); //$NON-NLS-1$
             } catch (Exception e) {
                 LOGGER.error("Failed to run test {} runnable {}", testName, runnable, e);
             }