001 /*
002 * $Id: SkipTestOn.java,v 1.11 2012/02/20 22:00:32 oboehm Exp $
003 *
004 * Copyright (c) 2010 by Oliver Boehm
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express orimplied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 *
018 * (c)reated 25.01.2010 by oliver (ob@oasd.de)
019 */
020
021 package patterntesting.runtime.annotation;
022
023 import static patterntesting.runtime.NullConstants.NULL_STRING;
024
025 import java.lang.annotation.*;
026
027 /**
028 * You have a test which should be skipped on Linux or another operationg
029 * system? Or a test which should be skipped on a special JavaVM?
030 * Then you can use this annotation to skip a single test (put the
031 * annotation in front of the test method) or all tests in this class (put
032 * the annotation in front of the class).
033 * <br/>
034 * What is the difference to <code>@Broken</code>?
035 * "Broken" means, the test does not work for the moment and should be
036 * (temporarily) skipped. "SkipTestOn" means, this test is not constructed
037 * for that platform and should be therefore skipped on it.
038 *
039 * @see Broken
040 * @see RunTestOn
041 * @author oliver
042 * @since 1.0 (25.01.2010)
043 */
044 @Documented
045 @Target({ElementType.METHOD, ElementType.TYPE})
046 @Retention(RetentionPolicy.RUNTIME)
047 public @interface SkipTestOn {
048
049 /**
050 * Here you can define the name of the operating system or version of the
051 * JDK for which a test should be skipped. But it is better to use the
052 * attributes "osName" or "javaVersion" here because otherwise
053 * PatternTesting tries to guess what you mean.
054 * <br/>
055 * Since 1.2 wildcards (*, ?) are supported.
056 *
057 * @see #osName()
058 * @see #javaVersion()
059 */
060 String[] value() default NULL_STRING;
061
062 /**
063 * Should a test be skipped on a single platform e.g. for Linux?
064 * Use "Linux" to mark it as broken only for the Linux platform.
065 * Instead of "Linux" you can use any other operation system. The
066 * format must be the same as returned by the system property "os.name".
067 * Valid values are:
068 * <ul>
069 * <li>"Linux"</li>
070 * <li>"Mac OS X" (for Mac),</li>
071 * <li>"Windows XP"</li>
072 * <li>and others
073 * (see {@link "http://lopica.sourceforge.net/os.html"}).
074 * </li>
075 * </ul>
076 * Multiple values like <code>{ "Linux", "Mac OS X" }</code> are allowed.
077 * If no operation system is given you will get an IllegalArgumentException.
078 * <br/>
079 * The format of this attribute must be the same as returned by system
080 * property "os.name".
081 * <br/>
082 * Since 1.2 wildcards (*, ?) are supported.
083 */
084 String[] osName() default NULL_STRING;
085
086 /**
087 * You want the test only to be skipped for the Intel architecture?
088 * Then you can use this attribute to limit it on this platform.
089 * You can define a single platform like <code>"x86_64"</code> for an
090 * Intel-Mac with 64 bit or multiple platform like
091 * <code>{ "x86_32", "x86_64" }</code> for Intel Mac with 42 or 64 bit.
092 * <br/>
093 * The format of this attribute must be the same as returned by the system
094 * property "os.arch".
095 * <br/>
096 * Since 1.2 wildcards (*, ?) are supported.
097 */
098 String[] osArch() default NULL_STRING;
099
100 /**
101 * You want the test only to be skipped for a special version of the
102 * operating system? Use this attribute to limit it.
103 * In contradiction to the other attributes the real version must start
104 * with the given version. I.e. if you define "10.6" as version this would
105 * match only real version "10.6.1" or "10.6.2".
106 * <br/>
107 * You can't define a range of skipped versions. But several versions are
108 * allowed. So if you want to skip the tests in version 10.6.1 till 10.6.3
109 * define { "10.6.1", "10.6.2", "10.6.3" } as values.
110 * The format of this attribute must be the same as returned by the system
111 * property "osVersion".
112 * <br/>
113 * Since 1.2 wildcards (*, ?) are supported.
114 */
115 String[] osVersion() default NULL_STRING;
116
117 /**
118 * With this attribute you can express that the test should be skipped on
119 * the given host(s). You can define the host by its name or by its
120 * IP address.
121 * <br/>
122 * Since 1.2 wildcards (*, ?) are supported.
123 */
124 String[] host() default NULL_STRING;
125
126 /**
127 * You want the test to be skipped on a special version of the VM, e.g. on
128 * version "1.6.0_17" because you know that on this version there is a bug
129 * that caused your test not to work? Then use this attribute.
130 * <br/>
131 * You can't define a range of skipped versions. But you regex (regular
132 * expressions) are allowed. And you can define more than one version
133 * (or regex).
134 * <br/>
135 * The format of this attribute must be the same as returned by the
136 * system property "java.version".
137 * <br/>
138 * Since 1.2 wildcards (*, ?) are supported.
139 */
140 String[] javaVersion() default NULL_STRING;
141
142 /**
143 * You want the test to be skipped on a special vendor VM? Use this attribute
144 * here. The format of this attribute must be the same as returned by the
145 * system property "java.vendor".
146 * Valid values are:
147 * <ul>
148 * <li>"Apple Inc."</li>
149 * <li>"IBM Corporation"</li>
150 * <li>and others</li>
151 * </ul>
152 * <br/>
153 * Since 1.2 wildcards (*, ?) are supported.
154 */
155 String[] javaVendor() default NULL_STRING;
156
157 /**
158 * Does the test should skipped only for user "Bob" because he is not allow
159 * to use the database?
160 * Use <code>user="bob"</code> to skip it for his account.
161 * <br/>
162 * Damn, the new member of the team, Bill, has similar restrictions.
163 * Ok, use <code>user={"bob", "bill"}</code> skip the test for both
164 * accounts.
165 * <br/>
166 * Since 1.2 wildcards (*, ?) are supported.
167 *
168 * @since 1.1
169 */
170 String[] user() default NULL_STRING;
171
172 /**
173 * You have some tests that does not run when you are offline? Define a
174 * property (e.g. <code>property="offline"</code>).
175 * If this property is set (and its value is
176 * not "false") the test will be skipped if you start the JavaVM with
177 * <code>java -Doffline ...</code> or <code>java -Doffline=true ...</code>.
178 * <br/>
179 * You can control more than property with this attribute. Then all
180 * properties must be "true" to skip the test.
181 * <br/>
182 * Wildcards (*, ?) are not yet supported for system properties.
183 */
184 String[] property() default NULL_STRING;
185
186 }
187