diff --git a/community-tests/community-tests.iml b/community-tests/community-tests.iml index 2cc9c7b7c46e..11e3fe91cdb1 100644 --- a/community-tests/community-tests.iml +++ b/community-tests/community-tests.iml @@ -12,15 +12,6 @@ - - - - - - - - - @@ -29,17 +20,6 @@ - - - - - - - - - - - diff --git a/community-tests/src/com/intellij/tests/gui/BelongsToTestGroups.java b/community-tests/src/com/intellij/tests/gui/BelongsToTestGroups.java deleted file mode 100644 index 4f497d6bb164..000000000000 --- a/community-tests/src/com/intellij/tests/gui/BelongsToTestGroups.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * 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.intellij.tests.gui; - -import com.intellij.tests.gui.framework.TestGroup; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface BelongsToTestGroups { - TestGroup[] value(); -} diff --git a/community-tests/src/com/intellij/tests/gui/GuiTestSuite.java b/community-tests/src/com/intellij/tests/gui/GuiTestSuite.java deleted file mode 100644 index 3d1a6b8f6ab8..000000000000 --- a/community-tests/src/com/intellij/tests/gui/GuiTestSuite.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * 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.intellij.tests.gui; - -import org.junit.runner.RunWith; - -@RunWith(GuiTestSuiteRunner.class) -public class GuiTestSuite { - -} diff --git a/community-tests/src/com/intellij/tests/gui/GuiTestSuiteRunner.java b/community-tests/src/com/intellij/tests/gui/GuiTestSuiteRunner.java deleted file mode 100644 index c0d11bc3a25e..000000000000 --- a/community-tests/src/com/intellij/tests/gui/GuiTestSuiteRunner.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * 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.intellij.tests.gui; - -import com.google.common.collect.Lists; -import com.intellij.tests.gui.framework.GuiTestCase; -import com.intellij.tests.gui.framework.IdeTestApplication; -import com.intellij.tests.gui.framework.TestGroup; -import org.jetbrains.annotations.NotNull; -import org.junit.runner.Runner; -import org.junit.runner.notification.RunNotifier; -import org.junit.runners.Suite; -import org.junit.runners.model.InitializationError; -import org.junit.runners.model.RunnerBuilder; -import org.junit.runners.model.Statement; - -import java.io.File; -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Collections; -import java.util.List; - -import static com.intellij.openapi.util.io.FileUtil.notNullize; -import static com.intellij.tests.gui.framework.GuiTests.GUI_TESTS_RUNNING_IN_SUITE_PROPERTY; -import static org.fest.assertions.Assertions.assertThat; - -/** - * Test runner that automatically includes all test classes that extend {@link GuiTestCase}, or if specified, the tests belonging to - * specific groups. - */ -public class GuiTestSuiteRunner extends Suite { - - final public static String DOT_CLASS = ".class"; - - @Retention(RetentionPolicy.RUNTIME) - public @interface IncludeTestGroups { - TestGroup[] value(); - } - - public GuiTestSuiteRunner(Class suiteClass, RunnerBuilder builder) throws InitializationError { - super(builder, suiteClass, getGuiTestClasses(suiteClass)); - System.setProperty(GUI_TESTS_RUNNING_IN_SUITE_PROPERTY, "true"); - } - - @NotNull - public static Class[] getGuiTestClasses(@NotNull Class suiteClass) throws InitializationError { - List guiTestClassFiles = Lists.newArrayList(); - List suiteGroups = getSuiteGroups(suiteClass); - File parentDir = getParentDir(suiteClass); - - String packagePath = suiteClass.getPackage().getName().replace('.', File.separatorChar); - int packagePathIndex = parentDir.getPath().indexOf(packagePath); - assertThat(packagePathIndex).isGreaterThan(-1); - String testDirPath = parentDir.getPath().substring(0, packagePathIndex); - - findPotentialGuiTestClassFiles(parentDir, guiTestClassFiles); - List> guiTestClasses = Lists.newArrayList(); - ClassLoader classLoader = suiteClass.getClassLoader(); - for (File classFile : guiTestClassFiles) { - String path = classFile.getPath(); - String className = path.substring(testDirPath.length(), path.indexOf(DOT_CLASS)).replace(File.separatorChar, '.'); - try { - Class testClass = classLoader.loadClass(className); - if (GuiTestCase.class.isAssignableFrom(testClass) && isInGroup(testClass, suiteGroups)) { - guiTestClasses.add(testClass); - } - } - catch (ClassNotFoundException e) { - throw new InitializationError(e); - } - } - return guiTestClasses.toArray(new Class[guiTestClasses.size()]); - } - - @NotNull - private static List getSuiteGroups(@NotNull Class suiteClass) { - for (Annotation annotation : suiteClass.getAnnotations()) { - if (annotation instanceof IncludeTestGroups) { - TestGroup[] values = ((IncludeTestGroups)annotation).value(); - if (values != null) { - return Lists.newArrayList(values); - } - break; - } - } - return Collections.emptyList(); - } - - private static void findPotentialGuiTestClassFiles(@NotNull File directory, @NotNull List guiTestClassFiles) { - File[] children = notNullize(directory.listFiles()); - for (File child : children) { - if (child.isDirectory()) { - findPotentialGuiTestClassFiles(child, guiTestClassFiles); - continue; - } - if (child.isFile() && !child.isHidden() && child.getName().endsWith("Test.class")) { - guiTestClassFiles.add(child); - } - } - } - - @NotNull - private static File getParentDir(@NotNull Class clazz) throws InitializationError { - URL classUrl = clazz.getResource(clazz.getSimpleName() + DOT_CLASS); - try { - return new File(classUrl.toURI()).getParentFile(); - } - catch (URISyntaxException e) { - throw new InitializationError(e); - } - } - - private static boolean isInGroup(@NotNull Class testClass, List suiteGroups) { - if (suiteGroups.isEmpty()) { - return true; - } - for (TestGroup testGroup : getGroups(testClass)) { - if (suiteGroups.contains(testGroup)) { - return true; - } - } - return false; - } - - @NotNull - public static List getGroups(@NotNull Class suiteClass) { - for (Annotation annotation : suiteClass.getAnnotations()) { - if (annotation instanceof BelongsToTestGroups) { - TestGroup[] values = ((BelongsToTestGroups)annotation).value(); - if (values != null) { - return Lists.newArrayList(values); - } - break; - } - } - return Collections.emptyList(); - } - - @Override - @NotNull - protected Statement childrenInvoker(final RunNotifier notifier) { - return new Statement() { - @Override - public void evaluate() { - // Run all the tests and dispose IdeTestApplication at the end. - for (final Runner child : getChildren()) { - runChild(child, notifier); - } - IdeTestApplication.disposeInstance(); - } - }; - } -} diff --git a/community-tests/src/com/intellij/tests/gui/test/GitGuiTest.kt b/community-tests/src/com/intellij/tests/gui/test/GitGuiTest.kt index e448bdec34ae..9de89c395902 100644 --- a/community-tests/src/com/intellij/tests/gui/test/GitGuiTest.kt +++ b/community-tests/src/com/intellij/tests/gui/test/GitGuiTest.kt @@ -19,11 +19,9 @@ import com.intellij.dvcs.ui.CloneDvcsDialog import com.intellij.dvcs.ui.DvcsBundle import com.intellij.openapi.project.DumbService import com.intellij.openapi.vcs.VcsBundle -import com.intellij.tests.gui.BelongsToTestGroups import com.intellij.tests.gui.fixtures.* import com.intellij.tests.gui.framework.GuiTestCase import com.intellij.tests.gui.framework.GuiTests -import com.intellij.tests.gui.framework.TestGroup import com.intellij.ui.EditorComboBox import org.fest.swing.edt.GuiActionRunner import org.fest.swing.edt.GuiTask @@ -33,7 +31,6 @@ import org.junit.Test /** * Created by karashevich on 18/06/16. */ -@BelongsToTestGroups(TestGroup.PROJECT) class GitGuiTest : GuiTestCase() { @Test diff --git a/community-tests/src/com/intellij/tests/gui/test/JavaEEProjectTest.java b/community-tests/src/com/intellij/tests/gui/test/JavaEEProjectTest.java index 7751aa4afe23..cd43df50e35c 100644 --- a/community-tests/src/com/intellij/tests/gui/test/JavaEEProjectTest.java +++ b/community-tests/src/com/intellij/tests/gui/test/JavaEEProjectTest.java @@ -18,7 +18,6 @@ package com.intellij.tests.gui.test; import com.intellij.openapi.application.ApplicationBundle; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.ProjectBundle; -import com.intellij.tests.gui.BelongsToTestGroups; import com.intellij.tests.gui.fixtures.ProjectViewFixture; import com.intellij.tests.gui.fixtures.ToolWindowFixture; import com.intellij.tests.gui.fixtures.WelcomeFrameFixture; @@ -26,7 +25,6 @@ import com.intellij.tests.gui.fixtures.newProjectWizard.NewProjectWizardFixture; import com.intellij.tests.gui.framework.GuiTestCase; import com.intellij.tests.gui.framework.GuiTests; import com.intellij.tests.gui.framework.IdeGuiTest; -import com.intellij.tests.gui.framework.TestGroup; import org.junit.Test; import javax.swing.*; @@ -41,7 +39,6 @@ import static com.intellij.tests.gui.framework.GuiTests.getSystemJdk; /** * Created by karashevich on 27/05/16. */ -@BelongsToTestGroups({TestGroup.PROJECT}) public class JavaEEProjectTest extends GuiTestCase { diff --git a/community-tests/src/com/intellij/tests/gui/test/JavaProjectTest.kt b/community-tests/src/com/intellij/tests/gui/test/JavaProjectTest.kt index 67f29036c932..f2861185395c 100644 --- a/community-tests/src/com/intellij/tests/gui/test/JavaProjectTest.kt +++ b/community-tests/src/com/intellij/tests/gui/test/JavaProjectTest.kt @@ -15,12 +15,10 @@ */ package com.intellij.tests.gui.test -import com.intellij.tests.gui.BelongsToTestGroups import com.intellij.tests.gui.fixtures.DialogFixtures.CreateDialogFixture import com.intellij.tests.gui.fixtures.EditorFixture import com.intellij.tests.gui.fixtures.JBPopupFixture import com.intellij.tests.gui.framework.GuiTestCase -import com.intellij.tests.gui.framework.TestGroup import com.intellij.tests.gui.framework.clickListItem import com.intellij.tests.gui.framework.createNewProject import org.junit.Ignore @@ -31,7 +29,6 @@ import javax.swing.text.JTextComponent /** * Created by karashevich on 18/06/16. */ -@BelongsToTestGroups(TestGroup.PROJECT) class JavaProjectTest: GuiTestCase() { @Test diff --git a/community-tests/src/com/intellij/tests/gui/test/NewProjectTest.java b/community-tests/src/com/intellij/tests/gui/test/NewProjectTest.java index 029c03d59127..93e5bc709d1f 100644 --- a/community-tests/src/com/intellij/tests/gui/test/NewProjectTest.java +++ b/community-tests/src/com/intellij/tests/gui/test/NewProjectTest.java @@ -17,13 +17,11 @@ package com.intellij.tests.gui.test; import com.intellij.openapi.application.ApplicationBundle; import com.intellij.openapi.project.ProjectBundle; -import com.intellij.tests.gui.BelongsToTestGroups; import com.intellij.tests.gui.fixtures.ProjectViewFixture; import com.intellij.tests.gui.fixtures.newProjectWizard.NewProjectWizardFixture; import com.intellij.tests.gui.framework.GuiTestCase; import com.intellij.tests.gui.framework.GuiTests; import com.intellij.tests.gui.framework.IdeGuiTest; -import com.intellij.tests.gui.framework.TestGroup; import org.junit.Ignore; import org.junit.Test; @@ -40,7 +38,6 @@ import static com.intellij.tests.gui.framework.GuiTests.getSystemJdk; /** * Created by karashevich on 27/05/16. */ -@BelongsToTestGroups({TestGroup.PROJECT}) public class NewProjectTest extends GuiTestCase { diff --git a/community-tests/src/com/intellij/tests/gui/test/ShortGuiTest.kt b/community-tests/src/com/intellij/tests/gui/test/ShortGuiTest.kt index e231db00184b..131146e83166 100644 --- a/community-tests/src/com/intellij/tests/gui/test/ShortGuiTest.kt +++ b/community-tests/src/com/intellij/tests/gui/test/ShortGuiTest.kt @@ -15,10 +15,8 @@ */ package com.intellij.tests.gui.test -import com.intellij.tests.gui.BelongsToTestGroups import com.intellij.tests.gui.fixtures.WelcomeFrameFixture import com.intellij.tests.gui.framework.GuiTestCase -import com.intellij.tests.gui.framework.TestGroup import com.intellij.tests.gui.framework.createNewProject import org.junit.Assert import org.junit.Test @@ -26,7 +24,6 @@ import org.junit.Test /** * Created by karashevich on 18/06/16. */ -@BelongsToTestGroups(TestGroup.PROJECT) class ShortGuiTest: GuiTestCase() { @Test diff --git a/community-tests/src/com/intellij/tests/gui/test/SimpleApplicationImportTest.kt b/community-tests/src/com/intellij/tests/gui/test/SimpleApplicationImportTest.kt index bdff19239c5f..16a88d436edc 100644 --- a/community-tests/src/com/intellij/tests/gui/test/SimpleApplicationImportTest.kt +++ b/community-tests/src/com/intellij/tests/gui/test/SimpleApplicationImportTest.kt @@ -15,16 +15,13 @@ */ package com.intellij.tests.gui.test -import com.intellij.tests.gui.BelongsToTestGroups import com.intellij.tests.gui.framework.GuiTestCase import com.intellij.tests.gui.framework.IdeGuiTest -import com.intellij.tests.gui.framework.TestGroup import org.junit.Test /** * Created by karashevich on 21/06/16. */ -@BelongsToTestGroups(TestGroup.PROJECT) class SimpleApplicationImportTest: GuiTestCase() { @Test @IdeGuiTest