details:   https://code.openbravo.com/erp/devel/pi/rev/976f1009134a
changeset: 33675:976f1009134a
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Mar 13 09:58:26 2018 +0100
summary:   fixed bug 38110: jUnit tests produce no feedback till completion

  - Now output is genereted while the test is executing
  - Removed plain formatter that added additional statistics about each test
    execution time as it is redundant with the info generated by xml formatter

details:   https://code.openbravo.com/erp/devel/pi/rev/b50c43b89bc1
changeset: 33676:b50c43b89bc1
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Mar 13 11:46:08 2018 +0100
summary:   fixed bug 38111: some test cases are too verbose

  Reduced verbosity by writing to log in debug mode for:
   GenerateTypesJSTest
   MenuTemplateTest
   MenuTest

diffstat:

 
modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/GenerateTypesJSTest.java
 |   7 ++-
 
modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/MenuTemplateTest.java
    |   9 +++-
 
modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/MenuTest.java
            |  12 ++++--
 src-test/build.xml                                                             
                                  |  17 +++------
 4 files changed, 25 insertions(+), 20 deletions(-)

diffs (205 lines):

diff -r a3ad3bc6723d -r b50c43b89bc1 
modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/GenerateTypesJSTest.java
--- 
a/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/GenerateTypesJSTest.java
  Tue Mar 13 10:28:31 2018 +0100
+++ 
b/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/GenerateTypesJSTest.java
  Tue Mar 13 11:46:08 2018 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2009-2011 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -30,6 +30,8 @@
 import org.openbravo.client.kernel.ComponentProvider;
 import org.openbravo.userinterface.smartclient.SmartClientComponentProvider;
 import org.openbravo.userinterface.smartclient.TypesComponent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Test the {@link TypesComponent} and its template.
@@ -37,6 +39,7 @@
  * @author mtaal
  */
 public class GenerateTypesJSTest extends WeldBaseTest {
+  private static final Logger log = 
LoggerFactory.getLogger(GenerateTypesJSTest.class);
 
   @Inject
   @ComponentProvider.Qualifier(SmartClientComponentProvider.QUALIFIER)
@@ -53,7 +56,7 @@
         TypesComponent.SC_TYPES_COMPONENT_ID, new HashMap<String, Object>());
 
     final String output = ComponentGenerator.getInstance().generate(component);
-    System.err.println(output);
+    log.debug(output);
   }
 
 }
\ No newline at end of file
diff -r a3ad3bc6723d -r b50c43b89bc1 
modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/MenuTemplateTest.java
--- 
a/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/MenuTemplateTest.java
     Tue Mar 13 10:28:31 2018 +0100
+++ 
b/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/MenuTemplateTest.java
     Tue Mar 13 11:46:08 2018 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2015 Openbravo SLU
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -27,6 +27,8 @@
 import org.openbravo.client.application.MainLayoutComponent;
 import org.openbravo.client.kernel.JSCompressor;
 import org.openbravo.client.kernel.JSLintChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Tests the generating of the menu through a template, menu is part of the 
MainLayoutComponent, so
@@ -35,6 +37,7 @@
  * @author mtaal
  */
 public class MenuTemplateTest extends WeldBaseTest {
+  private static final Logger log = LoggerFactory.getLogger(MenuTest.class);
 
   @Inject
   private MainLayoutComponent mainLayoutComponent;
@@ -43,7 +46,7 @@
   public void testApplication() throws Exception {
     setTestAdminContext();
     final String javascript = mainLayoutComponent.generate();
-    System.err.println(javascript);
+    log.debug(javascript);
 
     // do jslint check
     JSLintChecker.getInstance().check(mainLayoutComponent.getId(), javascript);
@@ -55,6 +58,6 @@
     assertTrue(compressed.length() < javascript.length());
     assertTrue(!compressed.equals(javascript));
     assertTrue(compressed.length() > 0);
-    System.err.println(compressed);
+    log.debug(compressed);
   }
 }
diff -r a3ad3bc6723d -r b50c43b89bc1 
modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/MenuTest.java
--- 
a/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/MenuTest.java
     Tue Mar 13 10:28:31 2018 +0100
+++ 
b/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/MenuTest.java
     Tue Mar 13 11:46:08 2018 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2014 Openbravo SLU
+ * All portions are Copyright (C) 2010-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -26,6 +26,8 @@
 import org.openbravo.base.weld.test.WeldBaseTest;
 import org.openbravo.client.application.MenuManager;
 import org.openbravo.client.application.MenuManager.MenuOption;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Tests the reading of the menu in memory
@@ -33,6 +35,7 @@
  * @author iperdomo
  */
 public class MenuTest extends WeldBaseTest {
+  private static final Logger log = LoggerFactory.getLogger(MenuTest.class);
 
   @Inject
   private MenuManager menuManager;
@@ -43,9 +46,7 @@
   @Test
   public void testSystemAdministratorMenu() throws Exception {
     setSystemAdministratorContext();
-    final long time = System.currentTimeMillis();
     final MenuManager.MenuOption rootMenuOption = menuManager.getMenu();
-    System.err.println((System.currentTimeMillis() - time));
     dumpMenuOption(rootMenuOption, 0);
     assertFalse(menuManager.getSelectableMenuOptions().isEmpty());
   }
@@ -62,13 +63,16 @@
   }
 
   private void dumpMenuOption(MenuOption menuOption, int level) {
+    if (!log.isDebugEnabled()) {
+      return;
+    }
     final StringBuilder sb = new StringBuilder();
     for (int i = 0; i < level; i++) {
       sb.append(">");
     }
     sb.append(menuOption.getLabel());
     sb.append(" (" + menuOption.getType() + "): " + menuOption.getId());
-    System.err.println(sb.toString());
+    log.debug(sb.toString());
     for (MenuOption childOption : menuOption.getChildren()) {
       dumpMenuOption(childOption, level + 1);
     }
diff -r a3ad3bc6723d -r b50c43b89bc1 src-test/build.xml
--- a/src-test/build.xml        Tue Mar 13 10:28:31 2018 +0100
+++ b/src-test/build.xml        Tue Mar 13 11:46:08 2018 +0100
@@ -13,7 +13,7 @@
  * and  limitations under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014-2017 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s): Openbravo S.L.U.
  ************************************************************************
@@ -73,17 +73,15 @@
   </target>
 
   <target name="run.tests" depends="compile.test, copy.xml">
-    <junit printsummary="yes" haltonfailure="yes">
+    <junit printsummary="no" haltonfailure="yes" showoutput="yes" 
outputtoformatters="false">
       <classpath refid="test.class.path" />
-      <formatter type="plain" usefile="no"/>
       <test name="org.openbravo.test.AntTaskTests" haltonfailure="no"/>
     </junit>
   </target>
 
   <target name="run.all.tests" depends="compile.test, copy.xml">
-    <junit printsummary="yes" haltonfailure="yes">
+    <junit printsummary="no" haltonfailure="yes" showoutput="yes" 
outputtoformatters="false">
       <classpath refid="test.class.path" />
-      <formatter type="plain" usefile="no"/>
       <test name="org.openbravo.test.AllAntTaskTests" haltonfailure="no" 
outfile="../src/result">
       <formatter type="xml" />
     </test>
@@ -91,17 +89,15 @@
   </target>
 
   <target name="run.quick.tests" depends="compile.test, copy.xml">
-    <junit printsummary="yes" haltonfailure="yes">
+    <junit printsummary="no" haltonfailure="yes" showoutput="yes" 
outputtoformatters="false">
       <classpath refid="test.class.path" />
-      <formatter type="plain" usefile="no"/>
       <test name="org.openbravo.test.AllQuickAntTaskTests" haltonfailure="no"/>
     </junit>
   </target>
 
   <target name="run.test" depends="compile.test, copy.xml">
-    <junit printsummary="yes" haltonfailure="yes">
+    <junit printsummary="no" haltonfailure="yes" showoutput="yes" 
outputtoformatters="false">
       <classpath refid="test.class.path" />
-      <formatter type="plain" usefile="no"/>
       <test name="${test}" haltonfailure="no" outfile="../src/result-${test}">
         <formatter type="xml"/>
       </test>
@@ -109,9 +105,8 @@
   </target>
 
   <target name="run.webservice.tests" depends="compile.test, copy.xml">
-    <junit printsummary="yes" haltonfailure="yes">
+    <junit printsummary="no" haltonfailure="yes" showoutput="yes" 
outputtoformatters="false">
       <classpath refid="test.class.path" />
-      <formatter type="plain" usefile="no"/>
       <test name="org.openbravo.test.AllWebserviceTests" haltonfailure="no" 
outfile="../src/resultws">
         <formatter type="xml" />
       </test>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to