Skip to content

Show error window if no test source root were found (#657) #680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import org.jetbrains.kotlin.idea.util.module
import org.utbot.engine.util.mockListeners.ForceMockListener
import org.utbot.framework.JdkPathService
import org.utbot.framework.UtSettings
import org.utbot.framework.codegen.ParametrizedTestSource
import org.utbot.framework.plugin.api.TestCaseGenerator
import org.utbot.framework.plugin.api.UtMethod
import org.utbot.framework.plugin.api.UtMethodTestSet
Expand All @@ -38,9 +37,6 @@ import org.utbot.framework.plugin.api.util.withUtContext
import org.utbot.intellij.plugin.generator.CodeGenerationController.generateTests
import org.utbot.intellij.plugin.models.GenerateTestsModel
import org.utbot.intellij.plugin.ui.GenerateTestsDialogWindow
import org.utbot.intellij.plugin.ui.utils.jdkVersion
import org.utbot.intellij.plugin.ui.utils.showErrorDialogLater
import org.utbot.intellij.plugin.ui.utils.testModule
import org.utbot.intellij.plugin.util.IntelliJApiHelper
import org.utbot.intellij.plugin.util.PluginJdkPathProvider
import org.utbot.intellij.plugin.util.signature
Expand All @@ -54,6 +50,11 @@ import org.utbot.common.filterWhen
import org.utbot.engine.util.mockListeners.ForceStaticMockListener
import org.utbot.framework.plugin.api.testFlow
import org.utbot.intellij.plugin.settings.Settings
import org.utbot.intellij.plugin.ui.utils.isGradle
import org.utbot.intellij.plugin.ui.utils.jdkVersion
import org.utbot.intellij.plugin.ui.utils.showErrorDialogLater
import org.utbot.intellij.plugin.ui.utils.suitableTestSourceRoots
import org.utbot.intellij.plugin.ui.utils.testModule
import org.utbot.intellij.plugin.util.isAbstract
import kotlin.reflect.KClass
import kotlin.reflect.full.functions
Expand Down Expand Up @@ -89,6 +90,15 @@ object UtTestsDialogProcessor {
return null
}

if (project.isGradle() && testModule.suitableTestSourceRoots().isEmpty()) {
val errorMessage = """
<html>No test source roots found in the project.<br>
Please, <a href="https://www.jetbrains.com/help/idea/testing.html#add-test-root">create or configure</a> at least one test source root.
""".trimIndent()
showErrorDialogLater(project, errorMessage, "Test source roots not found")
return null
}

return GenerateTestsDialogWindow(
GenerateTestsModel(
project,
Expand Down