diff --git a/utbot-intellij/src/test/kotlin/org/utbot/pages/IdeaGradleFrame.kt b/utbot-intellij/src/test/kotlin/org/utbot/pages/IdeaGradleFrame.kt index a6351c045d..52d0fad081 100644 --- a/utbot-intellij/src/test/kotlin/org/utbot/pages/IdeaGradleFrame.kt +++ b/utbot-intellij/src/test/kotlin/org/utbot/pages/IdeaGradleFrame.kt @@ -42,7 +42,7 @@ class IdeaGradleFrame(remoteRobot: RemoteRobot, remoteComponent: RemoteComponent hasText("src").and(hasText("main")).and(hasText("java")) } } - if (hasText("org.example").not()) { + if (hasText("Main").not()) { findText("java").doubleClick() } } diff --git a/utbot-intellij/src/test/kotlin/org/utbot/samples/CodeSamples.kt b/utbot-intellij/src/test/kotlin/org/utbot/samples/CodeSamples.kt index 3a19275e4b..0464782fe3 100644 --- a/utbot-intellij/src/test/kotlin/org/utbot/samples/CodeSamples.kt +++ b/utbot-intellij/src/test/kotlin/org/utbot/samples/CodeSamples.kt @@ -15,7 +15,7 @@ fun TextEditorFixture.typeAdditionFunction(className: String): String { key(KeyEvent.VK_END) enterText("{") enter() - enterText("// UTBot UI ${TEST_RUN_NUMBER} test") + enterText("// Test run ${TEST_RUN_NUMBER}") enter() enterText("return a + b;") } @@ -32,7 +32,7 @@ fun TextEditorFixture.typeDivisionFunction(className: String) : String { key(KeyEvent.VK_END) enterText("{") enter() - enterText("// ${TEST_RUN_NUMBER}") + enterText("// Test run ${TEST_RUN_NUMBER}") enter() enterText("return a / b;") } diff --git a/utbot-intellij/src/test/kotlin/org/utbot/tests/CreateProjects.kt b/utbot-intellij/src/test/kotlin/org/utbot/tests/CreateProjects.kt index b7c54f2fdf..eee5299898 100644 --- a/utbot-intellij/src/test/kotlin/org/utbot/tests/CreateProjects.kt +++ b/utbot-intellij/src/test/kotlin/org/utbot/tests/CreateProjects.kt @@ -33,9 +33,6 @@ class CreateProjects : BaseTest() { val ideaFrame = getIdeaFrameForBuildSystem(remoteRobot, ideaBuildSystem) with(ideaFrame) { waitProjectIsCreated() - if (ideaBuildSystem == IdeaBuildSystem.INTELLIJ) { - createNewPackage("org.example") - } waitFor(Duration.ofSeconds(30)) { !isDumbMode() } diff --git a/utbot-intellij/src/test/kotlin/org/utbot/tests/UnitTestBotActionTest.kt b/utbot-intellij/src/test/kotlin/org/utbot/tests/UnitTestBotActionTest.kt index 64f7b8d564..3d5f7acb87 100644 --- a/utbot-intellij/src/test/kotlin/org/utbot/tests/UnitTestBotActionTest.kt +++ b/utbot-intellij/src/test/kotlin/org/utbot/tests/UnitTestBotActionTest.kt @@ -12,7 +12,6 @@ import org.utbot.data.NEW_PROJECT_NAME_START import org.utbot.pages.* import org.utbot.samples.typeAdditionFunction import org.utbot.samples.typeDivisionFunction -import java.time.Duration.ofMillis import java.time.Duration.ofSeconds class UnitTestBotActionTest : BaseTest() { @@ -20,8 +19,8 @@ class UnitTestBotActionTest : BaseTest() { @ParameterizedTest(name = "Generate tests in {0} project with JDK {1}") @MethodSource("supportedProjectsProvider") @Tags(Tag("Java"), Tag("UnitTestBot"), Tag("Positive")) - fun basicTestGeneration(ideaBuildSystem: IdeaBuildSystem, jdkVersion: JDKVersion, - remoteRobot: RemoteRobot) : Unit = with(remoteRobot) { + fun checkBasicTestGeneration(ideaBuildSystem: IdeaBuildSystem, jdkVersion: JDKVersion, + remoteRobot: RemoteRobot) { val createdProjectName = NEW_PROJECT_NAME_START + ideaBuildSystem.system + jdkVersion.number remoteRobot.welcomeFrame { findText(createdProjectName).click() @@ -36,21 +35,19 @@ class UnitTestBotActionTest : BaseTest() { waitForIgnoringError (ofSeconds(5)){ inlineProgressTextPanel.isShowing } - waitForIgnoringError(ofSeconds(60), ofMillis(100)) { - inlineProgressTextPanel.hasText("Generate tests: read classes") - } - waitForIgnoringError (ofSeconds(30)){ + waitForIgnoringError (ofSeconds(90)){ inlineProgressTextPanel.hasText("Generate test cases for class $newClassName") } - waitForIgnoringError(ofSeconds(60)) { //Can be changed to 60 for a complex class + waitForIgnoringError(ofSeconds(30)) { utbotNotification.title.hasText("UnitTestBot: unit tests generated successfully") } assertThat(textEditor().editor.text).contains("class ${newClassName}Test") assertThat(textEditor().editor.text).contains("@Test\n") assertThat(textEditor().editor.text).contains("assertEquals(") assertThat(textEditor().editor.text).contains("@utbot.classUnderTest {@link ${newClassName}}") - assertThat(textEditor().editor.text).contains("@utbot.methodUnderTest {@link ${newClassName}#division(int, int)}") + assertThat(textEditor().editor.text).contains("@utbot.methodUnderTest {@link ${newClassName}#") assertThat(textEditor().editor.text).contains(returnsFromTagBody) + //ToDo verify how many tests are generated //ToDo verify Problems view and Arithmetic exception on it } } @@ -58,14 +55,14 @@ class UnitTestBotActionTest : BaseTest() { @ParameterizedTest(name = "Check Generate tests button is disabled in {0} project with unsupported JDK {1}") @MethodSource("unsupportedProjectsProvider") @Tags(Tag("Java"), Tag("UnitTestBot"), Tag("Negative")) - fun checkTestGenerationIsUnavailable(ideaBuildSystem: IdeaBuildSystem, jdkVersion: JDKVersion, - remoteRobot: RemoteRobot) : Unit = with(remoteRobot) { + fun checkProjectWithUnsupportedJDK(ideaBuildSystem: IdeaBuildSystem, jdkVersion: JDKVersion, + remoteRobot: RemoteRobot) { val createdProjectName = NEW_PROJECT_NAME_START + ideaBuildSystem.system + jdkVersion.number remoteRobot.welcomeFrame { findText(createdProjectName).click() } val ideaFrame = getIdeaFrameForBuildSystem(remoteRobot, ideaBuildSystem) - with (ideaFrame) { + return with (ideaFrame) { val newClassName = "Arithmetic" createNewJavaClass(newClassName, "Main") textEditor().typeAdditionFunction(newClassName)