patterntesting.runtime.annotation
Annotation Type Broken


@Documented
@Target(value={METHOD,CONSTRUCTOR,TYPE})
@Retention(value=RUNTIME)
public @interface Broken

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 SmokeRunner class. You should use this annotation together with @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.

Since:
23.11.2009
Author:
oliver
See Also:
SkipTestOn

Optional Element Summary
 String[] host
          With this attribute you can express that the test is broken for the given host(s).
 String[] javaVendor
          The test is broken for a special vendor VM?
 String[] javaVersion
          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?
 String[] os
          Deprecated. use osName()
 String[] osArch
          The test is broken only for the Intel architecture?
 String[] osName
          Should a test be skipped on a single platform e.g. for Linux?
 String[] osVersion
          The test breaks only on a special version of the operating system?
 String[] property
          You have some tests that are broken if some proxy properties are set?
 String since
          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.
 String till
          Use this attribute till you want the broken JUnit test to be fixed.
 String[] user
          Does the test break only for user "Bob" and you can't fix it for him at the moment?
 String value
          You can change the default string to give a reason why the test is marked as "broken".
 String why
          You can change the default string to give a reason why the test is marked as "broken".
 

value

public abstract String value
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.

Default:
"marked as @Broken"

why

public abstract String why
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.

Default:
""

since

public abstract String since
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".

Default:
""

till

public abstract String till
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".

Default:
""

os

public abstract String[] os
Deprecated. use osName()

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: Multiple values like { "Linux", "Mac OS X" } are allowed.

Default:
""

user

public abstract String[] user
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
Default:
""

osName

public abstract String[] osName
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: 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
Default:
""

osArch

public abstract String[] osArch
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
Default:
""

osVersion

public abstract String[] osVersion
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
Default:
""

host

public abstract String[] host
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
Default:
""

javaVersion

public abstract String[] javaVersion
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
Default:
""

javaVendor

public abstract String[] javaVendor
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:

Since:
1.1
Default:
""

property

public abstract String[] property
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
Default:
""


Copyright © 2002–2014 PatternTesting Team. All rights reserved.