Annotation Type SkipTestOn


  • @Documented
    @Target({METHOD,TYPE})
    @Retention(RUNTIME)
    public @interface SkipTestOn
    You have a test which should be skipped on Linux or another operationg system? Or a test which should be skipped on a special JavaVM? Then you can use this annotation to skip a single test (put the annotation in front of the test method) or all tests in this class (put the annotation in front of the class).

    What is the difference to @Broken? "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:
    1.0 (25.01.2010)
    Author:
    oliver
    See Also:
    Broken, RunTestOn
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      int[] day
      With the day attribute you can skip the run of your tests on special days.
      boolean hide
      Normally a test would be listed as "ignore" if it is skipped.
      java.lang.String[] host
      With this attribute you can express that the test should be skipped on the given host(s).
      java.lang.String[] javaVendor
      You want the test to be skipped on a special vendor VM?
      java.lang.String[] javaVersion
      You want the test to be skipped 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?
      java.lang.String[] osArch
      You want the test only to be skipped for the Intel architecture?
      java.lang.String[] osName
      Should a test be skipped on a single platform e.g. for Linux?
      java.lang.String[] osVersion
      You want the test only to be skipped for a special version of the operating system?
      java.lang.String[] property
      You have some tests that does not run when you are offline?
      java.lang.String[] time
      With the time attribute you can limit the run of your tests on special hours.
      java.lang.String[] user
      Does the test should skipped only for user "Bob" because he is not allow to use the database?
      java.lang.String[] value
      Here you can define the name of the operating system or version of the JDK for which a test should be skipped.
    • Element Detail

      • value

        java.lang.String[] value
        Here you can define the name of the operating system or version of the JDK for which a test should be skipped. But it is better to use the attributes "osName" or "javaVersion" here because otherwise PatternTesting tries to guess what you mean.

        Since 1.2 wildcards (*, ?) are supported.

        Returns:
        the string[]
        See Also:
        osName(), javaVersion()
        Default:
        {""}
      • osArch

        java.lang.String[] osArch
        You want the test only to be skipped 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.2 wildcards (*, ?) are supported.

        Returns:
        the string[]
        Default:
        {""}
      • osName

        java.lang.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:
        • "Linux"
        • "Mac OS X" (for Mac),
        • "Windows XP"
        • and others (see 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.2 wildcards (*, ?) are supported.

        Returns:
        the string[]
        Default:
        {""}
      • osVersion

        java.lang.String[] osVersion
        You want the test only to be skipped for 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.2 wildcards (*, ?) are supported.

        Returns:
        the string[]
        Default:
        {""}
      • javaVersion

        java.lang.String[] javaVersion
        You want the test to be skipped 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 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.2 wildcards (*, ?) are supported.

        Returns:
        the string[]
        Default:
        {""}
      • javaVendor

        java.lang.String[] javaVendor
        You want the test to be skipped on 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."
        • "IBM Corporation"
        • and others

        Since 1.2 wildcards (*, ?) are supported.

        Returns:
        the string[]
        Default:
        {""}
      • user

        java.lang.String[] user
        Does the test should skipped only for user "Bob" because he is not allow to use the database? Use user="bob" to skip it for his account.

        Damn, the new member of the team, Bill, has similar restrictions. Ok, use user={"bob", "bill"} skip the test for both accounts.

        Since 1.2 wildcards (*, ?) are supported.

        Returns:
        the string[]
        Since:
        1.1
        Default:
        {""}
      • host

        java.lang.String[] host
        With this attribute you can express that the test should be skipped on the given host(s). You can define the host by its name or by its IP address.

        Since 1.2 wildcards (*, ?) are supported.

        Returns:
        the string[]
        Default:
        {""}
      • property

        java.lang.String[] property
        You have some tests that does not run when you are offline? Define a property (e.g. property="offline"). If this property is set (and its value is not "false") the test will be skipped if you start the JavaVM with java -Doffline ... or java -Doffline=true ....

        You can control more than property with this attribute. Then all properties must be "true" to skip the test.

        Wildcards (*, ?) are not yet supported for system properties.

        Returns:
        the string[]
        Default:
        {""}
      • day

        int[] day
        With the day attribute you can skip the run of your tests on special days. Some tests (especially long running integration tests) need not to run all days.

        The days are given as number where 1 = Monday and 7 = Sunday.

        Returns:
        e.g. { 1, 2, 3, 4, 5 } for the working days
        Since:
        1.6
        Default:
        {}
      • time

        java.lang.String[] time
        With the time attribute you can limit the run of your tests on special hours. E.g. you can define some "happy hours" for tests which needs a little bit longer.

        The pattern for the definition of the time range is "HH:mm-HH:mm", e.g. "0:00-24:00" for the whole day. You can also define several time ranges e.g. { "6:00-8:00", "18:00-20:00" }

        Returns:
        e.g. "18:00-6:00" for the whole night for 18 o'clock and 6 o'clock.
        Since:
        1.6
        Default:
        {""}
      • hide

        boolean hide
        Normally a test would be listed as "ignore" if it is skipped. If you do not want this set this flag to true. This can be useful if you must pass some quality gates which do not allow ignored tests (e.g. if you use Sonar that can be a quality gate).

        NOTE: Because of limitations of JUnit and the RemoteTestRunner of Eclipse this flag not supported at class level, only on method level. If you'll try to set in on class level you will get an UnsupportedOperationException at runtime.

        Returns:
        true, if successful
        Since:
        1.5
        Default:
        false