mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gui-test] add DisabledOnOs annotation
This commit is contained in:
+17
-2
@@ -27,6 +27,7 @@ import com.intellij.testGuiFramework.launcher.GradleLauncher
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestLocalLauncher
|
||||
import com.intellij.testGuiFramework.launcher.GuiTestOptions
|
||||
import com.intellij.testGuiFramework.launcher.ide.Ide
|
||||
import com.intellij.testGuiFramework.launcher.system.SystemInfo
|
||||
import com.intellij.testGuiFramework.remote.IdeControl.closeIde
|
||||
import com.intellij.testGuiFramework.remote.IdeControl.ensureIdeIsRunning
|
||||
import com.intellij.testGuiFramework.remote.IdeControl.restartIde
|
||||
@@ -37,6 +38,7 @@ import com.intellij.testGuiFramework.remote.server.JUnitServerHolder
|
||||
import com.intellij.testGuiFramework.remote.transport.*
|
||||
import com.intellij.testGuiFramework.testCases.PluginTestCase.Companion.PLUGINS_INSTALLED
|
||||
import com.intellij.testGuiFramework.testCases.SystemPropertiesTestCase.Companion.SYSTEM_PROPERTIES
|
||||
import com.intellij.testGuiFramework.util.DisabledOnOs
|
||||
import com.intellij.util.io.exists
|
||||
import org.junit.Assert
|
||||
import org.junit.AssumptionViolatedException
|
||||
@@ -81,11 +83,20 @@ open class GuiTestRunner internal constructor(open val runner: GuiTestRunnerInte
|
||||
val systemProperties = getSystemPropertiesFromAnnotation(method.declaringClass)
|
||||
|
||||
val eachNotifier = EachTestNotifier(notifier, description)
|
||||
if (criticalError.get()) {
|
||||
eachNotifier.fireTestIgnored(); return
|
||||
|
||||
if (testShouldBeIgnored(method)) {
|
||||
eachNotifier.fireTestIgnored()
|
||||
return
|
||||
}
|
||||
|
||||
val testName = runner.getTestName(method.name)
|
||||
|
||||
if (criticalError.get()) {
|
||||
SERVER_LOG.info("Test $testName ignored by @DisabledOnOs annotation")
|
||||
eachNotifier.fireTestIgnored()
|
||||
return
|
||||
}
|
||||
|
||||
SERVER_LOG.info("Starting test on server side: $testName")
|
||||
|
||||
try {
|
||||
@@ -270,6 +281,10 @@ open class GuiTestRunner internal constructor(open val runner: GuiTestRunnerInte
|
||||
|
||||
companion object {
|
||||
private val LOG = Logger.getInstance("#com.intellij.testGuiFramework.framework.GuiTestRunner")
|
||||
|
||||
private fun testShouldBeIgnored(test: FrameworkMethod): Boolean =
|
||||
test.getAnnotation(DisabledOnOs::class.java)?.os?.contains(SystemInfo.getSystemType()) ?: false ||
|
||||
test.declaringClass.getAnnotation(DisabledOnOs::class.java)?.os?.contains(SystemInfo.getSystemType()) ?: false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.testGuiFramework.util
|
||||
|
||||
import com.intellij.testGuiFramework.launcher.system.SystemInfo
|
||||
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class DisabledOnOs(vararg val os: SystemInfo.SystemType)
|
||||
Reference in New Issue
Block a user