details:   https://code.openbravo.com/erp/devel/pi/rev/c8a6c060de10
changeset: 29268:c8a6c060de10
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Fri Apr 22 07:55:38 2016 +0200
summary:   fixed 32760: add to jUnit test cases log info about when they 
start/complete

  Now when test cases extending OBBaseTest are executed, a line is logged before
  they start and when they complete.

diffstat:

 src-test/src/org/openbravo/test/base/OBBaseTest.java |  13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diffs (36 lines):

diff -r 61348cc65973 -r c8a6c060de10 
src-test/src/org/openbravo/test/base/OBBaseTest.java
--- a/src-test/src/org/openbravo/test/base/OBBaseTest.java      Thu Apr 21 
19:37:16 2016 +0200
+++ b/src-test/src/org/openbravo/test/base/OBBaseTest.java      Fri Apr 22 
07:55:38 2016 +0200
@@ -71,12 +71,20 @@
   @Rule
   public TestWatcher watchFailures = new TestWatcher() {
     @Override
+    protected void starting(Description description) {
+      log.info("*** Starting test case: " + getTestName(description));
+    };
+
+    @Override
     protected void failed(Throwable e, Description description) {
       errorOccured = true;
     }
 
     @Override
     protected void finished(Description description) {
+      log.info("*** Finished test case: " + getTestName(description)
+          + (errorOccured ? " - with errors" : ""));
+
       // if not an administrator but still admin mode set throw an exception
       if (!OBContext.getOBContext().getUser().getId().equals("0")
           && !OBContext.getOBContext().getRole().getId().equals("0")
@@ -107,6 +115,11 @@
 
       super.finished(description);
     }
+
+    private String getTestName(Description description) {
+      return description.getClassName() + "." + description.getMethodName();
+    }
+
   };
 
   private static final Logger log = Logger.getLogger(OBBaseTest.class);

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to