From ea46029ea154cc018525219f06095817339607e8 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 29 Nov 2013 18:40:35 +0200 Subject: [PATCH] Allow excluding test from the standard test suite Mostly useful for very long running tests Change-Id: I9027f981da0a1e6ba464196449f2a9c27e965d2f --- .../vaadin/tests/tb3/ExcludeFromSuite.java | 28 +++++++++++++++++++ .../com/vaadin/tests/tb3/TB3TestSuite.java | 18 ++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java diff --git a/uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java b/uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java new file mode 100644 index 0000000000..722b643f78 --- /dev/null +++ b/uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java @@ -0,0 +1,28 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * 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 or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.tb3; + +/** + * Marker interface for a TB3+ test class which will exclude the test from any + * test suite which automatically scans for test classes. Mostly useful for long + * tests which should not be run in every build. + * + * @since 7.1.10 + * @author Vaadin Ltd + */ +public @interface ExcludeFromSuite { + +} diff --git a/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java b/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java index e1c8edfd60..f1576a9393 100644 --- a/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java +++ b/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java @@ -223,6 +223,10 @@ public class TB3TestSuite extends Suite { if (!baseClass.isAssignableFrom(c)) { return; } + if (!includeInSuite(c)) { + return; + } + if (!Modifier.isAbstract(c.getModifiers()) && !c.isAnonymousClass()) { result.add((Class) c); } @@ -235,4 +239,18 @@ public class TB3TestSuite extends Suite { } + /** + * @return true if the class should be included in the suite, false if not + */ + private static boolean includeInSuite(Class c) { + if (c.getAnnotation(ExcludeFromSuite.class) != null) { + return false; + } + if (c == Object.class) { + return true; + } + + return includeInSuite(c.getSuperclass()); + } + } \ No newline at end of file -- 2.39.5