Mercurial > hg > release > icedtea-web-1.4
changeset 660:126a7f9465ed
Modification of KnownToFail annotation (adding optional parameter failsIn)
author | Jana Fabrikova <jfabriko@redhat.com> |
---|---|
date | Wed, 03 Apr 2013 18:37:00 +0200 |
parents | 3405d5fc4339 |
children | 823350ebeef1 |
files | tests/junit-runner/JunitLikeXmlOutputListener.java tests/junit-runner/LessVerboseTextListener.java tests/test-extensions/net/sourceforge/jnlp/annotations/KnownToFail.java |
diffstat | 3 files changed, 46 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/junit-runner/JunitLikeXmlOutputListener.java Thu Mar 28 14:40:11 2013 -0400 +++ b/tests/junit-runner/JunitLikeXmlOutputListener.java Wed Apr 03 18:37:00 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++; } }
--- a/tests/junit-runner/LessVerboseTextListener.java Thu Mar 28 14:40:11 2013 -0400 +++ b/tests/junit-runner/LessVerboseTextListener.java Wed Apr 03 18:37:00 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) {
--- 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:37:00 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 {}; }