All Downloads are FREE. Search and download functionalities are using the official Maven repository.

patterntesting.runtime.annotation.Broken Maven / Gradle / Ivy

Go to download

PatternTesting Runtime (patterntesting-rt) is the runtime component for the PatternTesting framework. It provides the annotations and base classes for the PatternTesting testing framework (e.g. patterntesting-check, patterntesting-concurrent or patterntesting-exception) but can be also used standalone for classpath monitoring or profiling. It uses AOP and AspectJ to perform this feat.

There is a newer version: 2.4.0
Show newest version
/*
 * $Id: Broken.java,v 1.14 2011/03/18 06:43:32 oboehm Exp $
 *
 * Copyright (c) 2009 by Oliver Boehm
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express orimplied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * (c)reated 23.11.2009 by oliver ([email protected])
 */

package patterntesting.runtime.annotation;

import static patterntesting.runtime.NullConstants.*;

import java.lang.annotation.*;

/**
 * If you want to mark JUnit tests which does not work for the moment as
 * "broken" you can use this annotation. The tests will be skipped if you
 * run JUnit. You can also add a date till when you want to fix this "broken"
 * test. If the date is reached then the test will fail if it is not fixed
 * (and the @Broken removed).
 * 
* Before 1.0.0 this annotation was handled by BrokenAspect. But since 1.0.0 * it is handled now by the {@link patterntesting.runtime.junit.SmokeRunner} class. * You should use this annotation together with {@code @RunWith(SmokeRunner.class)}, * also for JUnit 3 tests. *
* You can also use this annotation to mark a method or constructor as * "broken". If assertions are enabled an AssertionError will be thrown if * you call such a broken method. If not only a error message will be logged. *
* What is the difference to @SkipTestOn? * "Broken" means, the test does not work for the moment and should be * (temporarily) skipped. "SkipTestOn" means, this test is not constructed * for that platform and should be therefore skipped on it. * * @see SkipTestOn * @author oliver * @since 23.11.2009 */ @Documented @Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Broken { /** * You can change the default string to give a reason why the test is * marked as "broken". * You can use 'value=...' or 'wyh=...' to change it. */ String value() default "marked as @Broken"; /** * You can change the default string to give a reason why the test is * marked as "broken". * You can use 'value=...' or 'why=...' to change it. */ String why() default NULL_STRING; /** * Use this attribute to mark the begin of the broken area, when it * was detected that your JUnit test or method does not work as expected. *
* The format of the date is "dd-MMM-yyyy". */ String since() default NULL_STRING; /** * Use this attribute till you want the broken JUnit test to be fixed. *
* The format of the date is "dd-MMM-yyyy" or "dd-MMM-yyyy H:mm". */ String till() default NULL_STRING; /** * Is a test only broken on a single platform e.g. on Linux? * Use os="Linux" to mark it as broken only for the Linux platform. * Instead of "Linux" you can use any other operation system. The * format must be the same as returned by the system property "os.name". * Valid values are: *
    *
  • "Linux"
  • *
  • "Mac OS X" (for Mac),
  • *
  • "Windows XP"
  • *
  • and others * (see {@link "http://lopica.sourceforge.net/os.html"}). *
  • *
* Multiple values like { "Linux", "Mac OS X" } are allowed. * * @deprecated use osName() */ String[] os() default NULL_STRING; /** * Does the test break only for user "Bob" and you can't fix it for him at * the moment? Use user="bob" to mark it as broken for user * account "bob". *
* Damn, the new member of the team, Bill, has the same problem and nobody * is able to fix it. Ok, use user={"bob", "bill"} to mark the * code as broken for both user. * * @since 1.0 */ String[] user() default NULL_STRING; /** * Should a test be skipped on a single platform e.g. for Linux? * Use "Linux" to mark it as broken only for the Linux platform. * Instead of "Linux" you can use any other operation system. The * format must be the same as returned by the system property "os.name". * Valid values are: *
    *
  • "Linux"
  • *
  • "Mac OS X" (for Mac),
  • *
  • "Windows XP"
  • *
  • and others * (see {@link "http://lopica.sourceforge.net/os.html"}). *
  • *
* Multiple values like { "Linux", "Mac OS X" } are allowed. * If no operation system is given you will get an IllegalArgumentException. *
* The format of this attribute must be the same as returned by system * property "os.name". * * @since 1.1 */ String[] osName() default NULL_STRING; /** * The test is broken only for the Intel architecture? * Then you can use this attribute to limit it on this platform. * You can define a single platform like "x86_64" for an * Intel-Mac with 64 bit or multiple platform like * { "x86_32", "x86_64" } for Intel Mac with 42 or 64 bit. *
* The format of this attribute must be the same as returned by the system * property "os.arch". * * @since 1.1 */ String[] osArch() default NULL_STRING; /** * The test breaks only on a special version of the * operating system? Use this attribute to limit it. * In contradiction to the other attributes the real version must start * with the given version. I.e. if you define "10.6" as version this would * match only real version "10.6.1" or "10.6.2". *
* You can't define a range of skipped versions. But several versions are * allowed. So if you want to skip the tests in version 10.6.1 till 10.6.3 * define { "10.6.1", "10.6.2", "10.6.3" } as values. * The format of this attribute must be the same as returned by the system * property "osVersion". * * @since 1.1 */ String[] osVersion() default NULL_STRING; /** * With this attribute you can express that the test is broken for * the given host(s). Perhaps these hosts have not enough memory. * You can define the host by its name or by its IP address. * * @since 1.1 */ String[] host() default NULL_STRING; /** * You want to mark the test as broken on a special version of the VM, e.g. on * version "1.6.0_17" because you know that on this version there is a bug * that caused your test not to work? Then use this attribute. *
* You can't define a range of skipped versions. But you regex (regular * expressions) are allowed. And you can define more than one version * (or regex). *
* The format of this attribute must be the same as returned by the * system property "java.version". * * @since 1.1 */ String[] javaVersion() default NULL_STRING; /** * The test is broken for a special vendor VM? Use this attribute * here. The format of this attribute must be the same as returned by the * system property "java.vendor". * Valid values are: *
    *
  • "Apple Inc."
  • *
  • and others
  • *
* * @since 1.1 */ String[] javaVendor() default NULL_STRING; /** * You have some tests that are broken if some proxy properties are set? * Define the property here (e.g. property="proxy.host"). * If this property is set (and its value is * not "false") the test will be skipped if this property is set as * system property. *
* You can control more than property with this attribute. Then all * properties must be "true" to skip the test. * * @since 1.1 */ String[] property() default NULL_STRING; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy