/hg/icedtea-web: 2 new changesets

jfabriko at icedtea.classpath.org jfabriko at icedtea.classpath.org
Wed Apr 3 09:45:57 PDT 2013


changeset 126a7f9465ed in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=126a7f9465ed
author: Jana Fabrikova <jfabriko at redhat.com>
date: Wed Apr 03 18:37:00 2013 +0200

	Modification of KnownToFail annotation (adding optional parameter failsIn)


changeset 823350ebeef1 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=823350ebeef1
author: Jana Fabrikova <jfabriko at redhat.com>
date: Wed Apr 03 18:48:44 2013 +0200

	Modification of KnownToFail annotation


diffstat:

 ChangeLog                                                               |  15 +++++
 tests/junit-runner/JunitLikeXmlOutputListener.java                      |  29 +++++++--
 tests/junit-runner/LessVerboseTextListener.java                         |  18 +++++-
 tests/test-extensions/net/sourceforge/jnlp/annotations/KnownToFail.java |   8 ++-
 4 files changed, 61 insertions(+), 9 deletions(-)

diffs (173 lines):

diff -r 3405d5fc4339 -r 823350ebeef1 ChangeLog
--- a/ChangeLog	Thu Mar 28 14:40:11 2013 -0400
+++ b/ChangeLog	Wed Apr 03 18:48:44 2013 +0200
@@ -1,3 +1,18 @@
+2013-04-03 Jana Fabrikova <jfabriko at redhat.com>
+
+	* /tests/test-extensions/net/sourceforge/jnlp/annotations/KnownToFailInBrowsers.java:
+	the implementation of new annotation, which has an array of
+	browsers of type Browsers[] named failsIn
+	* /tests/junit-runner/JunitLikeXmlOutputListener.java:
+	in method (testDone) the testcases that are known to fail in
+	current browser are detected in addition to the tests that are
+	k2f in all browsers
+	* /tests/junit-runner/LessVerboseTextListener.java:
+	added method (getK2FinB) reading the annotion,
+	in method (printK2F) the testcases that are known to fail in
+	current browser are detected in addition to the tests that are
+	k2f in all browsers
+
 2013-03-28  Adam Domurad  <adomurad at redhat.com>
 
 	* netx/net/sourceforge/jnlp/security/appletextendedsecurity/UnsignedAppletTrustConfirmation.java
diff -r 3405d5fc4339 -r 823350ebeef1 tests/junit-runner/JunitLikeXmlOutputListener.java
--- a/tests/junit-runner/JunitLikeXmlOutputListener.java	Thu Mar 28 14:40:11 2013 -0400
+++ b/tests/junit-runner/JunitLikeXmlOutputListener.java	Wed Apr 03 18:48:44 2013 +0200
@@ -20,10 +20,12 @@
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.Arrays;
 import java.util.concurrent.TimeUnit;
 import net.sourceforge.jnlp.annotations.Bug;
 import net.sourceforge.jnlp.annotations.KnownToFail;
 import net.sourceforge.jnlp.annotations.Remote;
+import net.sourceforge.jnlp.browsertesting.Browsers;
 
 
 import org.junit.internal.JUnitSystem;
@@ -201,17 +203,30 @@
             testcaseAtts.put(TEST_IGNORED_ATTRIBUTE, Boolean.TRUE.toString());
         }
         KnownToFail k2f = LessVerboseTextListener.getAnnotation(testClass, testMethod.getName(), KnownToFail.class);
+        boolean thisTestIsK2F = false;
         Remote remote =  LessVerboseTextListener.getAnnotation(testClass, testMethod.getName(), Remote.class);
         if (k2f != null) {
-            testcaseAtts.put(K2F, Boolean.TRUE.toString());
+            //determine if k2f in the current browser
+            //??
+            Browsers[] br = k2f.failsIn();
+            if(0 == br.length){//the KnownToFail annotation without optional parameter
+                thisTestIsK2F = true;
+            }else{
+                for(Browsers b : br){
+                    if(description.toString().contains(b.toString())){
+                        thisTestIsK2F = true;
+                    }
+                }
+            }
         }
+        if( thisTestIsK2F ) testcaseAtts.put(K2F, Boolean.TRUE.toString());
         if (remote != null) {
             testcaseAtts.put(REMOTE, Boolean.TRUE.toString());
 
         }
         openElement(TEST_ELEMENT, testcaseAtts);
         if (testFailed != null) {
-            if (k2f != null) {
+            if (thisTestIsK2F) {
                 failedK2F++;
             }
             Map<String, String> errorAtts = new HashMap<String, String>(3);
@@ -226,7 +241,7 @@
 
             writeElement(TEST_ERROR_ELEMENT, testFailed.getTrace(), errorAtts);
         } else {
-            if (k2f != null) {
+            if (thisTestIsK2F) {
                 if (ignored) {
                     ignoredK2F++;
                 } else {
@@ -265,25 +280,25 @@
             classStats.put(description.getClassName(), classStat);
         }
         classStat.total++;
-        if (k2f != null) {
+        if (thisTestIsK2F) {
             classStat.totalK2F++;
         }
         classStat.time += testTime;
         if (testFailed == null) {
             if (ignored) {
                 classStat.ignored++;
-                if (k2f != null) {
+                if (thisTestIsK2F) {
                     classStat.ignoredK2F++;
                 }
             } else {
                 classStat.passed++;
-                if (k2f != null) {
+                if (thisTestIsK2F) {
                     classStat.passedK2F++;
                 }
             }
         } else {
             classStat.failed++;
-            if (k2f != null) {
+            if (thisTestIsK2F) {
                 classStat.failedK2F++;
             }
         }
diff -r 3405d5fc4339 -r 823350ebeef1 tests/junit-runner/LessVerboseTextListener.java
--- a/tests/junit-runner/LessVerboseTextListener.java	Thu Mar 28 14:40:11 2013 -0400
+++ b/tests/junit-runner/LessVerboseTextListener.java	Wed Apr 03 18:48:44 2013 +0200
@@ -10,6 +10,7 @@
 import java.lang.reflect.Method;
 import net.sourceforge.jnlp.annotations.KnownToFail;
 import net.sourceforge.jnlp.annotations.Remote;
+import net.sourceforge.jnlp.browsertesting.Browsers;
 
 import org.junit.internal.JUnitSystem;
 import org.junit.runner.Description;
@@ -74,7 +75,22 @@
     private void printK2F(PrintStream writer, Boolean failed, Description description) {
         try {
             KnownToFail k2f = getK2F(description);
-            if (k2f != null) {
+            boolean thisTestIsK2F = false;
+            if (k2f != null){
+                //determine if k2f in the current browser
+                Browsers[] br = k2f.failsIn();
+                if(0 == br.length){ //@KnownToFail with default optional parameter failsIn={}
+                    thisTestIsK2F = true;
+                }else{
+                    for(Browsers b : br){
+                        if(description.toString().contains(b.toString())){
+                            thisTestIsK2F = true;
+                        }
+                    }
+                }
+            }
+
+            if( thisTestIsK2F ){
                 totalK2F++;
                 if (failed != null) {
                     if (failed) {
diff -r 3405d5fc4339 -r 823350ebeef1 tests/test-extensions/net/sourceforge/jnlp/annotations/KnownToFail.java
--- a/tests/test-extensions/net/sourceforge/jnlp/annotations/KnownToFail.java	Thu Mar 28 14:40:11 2013 -0400
+++ b/tests/test-extensions/net/sourceforge/jnlp/annotations/KnownToFail.java	Wed Apr 03 18:48:44 2013 +0200
@@ -41,6 +41,7 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
+import net.sourceforge.jnlp.browsertesting.Browsers;
 
 /**
  * <p>
@@ -52,10 +53,15 @@
  * This annotation is meant for adding tests for bugs before the fix is
  * implemented.
  * </p>
+ * <p>
+ * The meaning of optional parameter failsIn is either a list of 
+ * browsers where the test fails, or a default value - an empty array {},
+ * default value means that the test fails always.
+ * </p>
  */
 
 @Target({ElementType.METHOD,ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 public @interface KnownToFail {
-    
+    public Browsers[] failsIn() default {}; 
 }



More information about the distro-pkg-dev mailing list