@@ -12,62 +12,59 @@ import org.utbot.data.NEW_PROJECT_NAME_START
1212import org.utbot.pages.*
1313import org.utbot.samples.typeAdditionFunction
1414import org.utbot.samples.typeDivisionFunction
15- import java.time.Duration.ofMillis
1615import java.time.Duration.ofSeconds
1716
1817class UnitTestBotActionTest : BaseTest () {
1918
2019 @ParameterizedTest(name = " Generate tests in {0} project with JDK {1}" )
2120 @MethodSource(" supportedProjectsProvider" )
2221 @Tags(Tag (" Java" ), Tag (" UnitTestBot" ), Tag (" Positive" ))
23- fun basicTestGeneration (ideaBuildSystem : IdeaBuildSystem , jdkVersion : JDKVersion ,
24- remoteRobot : RemoteRobot ) : Unit = with (remoteRobot ) {
22+ fun checkBasicTestGeneration (ideaBuildSystem : IdeaBuildSystem , jdkVersion : JDKVersion ,
23+ remoteRobot : RemoteRobot ) {
2524 val createdProjectName = NEW_PROJECT_NAME_START + ideaBuildSystem.system + jdkVersion.number
2625 remoteRobot.welcomeFrame {
2726 findText(createdProjectName).click()
2827 }
2928 val ideaFrame = getIdeaFrameForBuildSystem(remoteRobot, ideaBuildSystem)
3029 with (ideaFrame) {
3130 val newClassName = " Arithmetic"
32- createNewJavaClass(newClassName, " org.example " )
31+ createNewJavaClass(newClassName, " Main " )
3332 val returnsFromTagBody = textEditor().typeDivisionFunction(newClassName)
3433 openUTBotDialogFromProjectViewForClass(newClassName)
3534 unitTestBotDialog.generateTestsButton.click()
3635 waitForIgnoringError (ofSeconds(5 )){
3736 inlineProgressTextPanel.isShowing
3837 }
39- waitForIgnoringError(ofSeconds(60 ), ofMillis(100 )) {
40- inlineProgressTextPanel.hasText(" Generate tests: read classes" )
41- }
42- waitForIgnoringError (ofSeconds(30 )){
38+ waitForIgnoringError (ofSeconds(90 )){
4339 inlineProgressTextPanel.hasText(" Generate test cases for class $newClassName " )
4440 }
45- waitForIgnoringError(ofSeconds(60 )) { // Can be changed to 60 for a complex class
41+ waitForIgnoringError(ofSeconds(30 )) {
4642 utbotNotification.title.hasText(" UnitTestBot: unit tests generated successfully" )
4743 }
4844 assertThat(textEditor().editor.text).contains(" class ${newClassName} Test" )
4945 assertThat(textEditor().editor.text).contains(" @Test\n " )
5046 assertThat(textEditor().editor.text).contains(" assertEquals(" )
5147 assertThat(textEditor().editor.text).contains(" @utbot.classUnderTest {@link ${newClassName} }" )
52- assertThat(textEditor().editor.text).contains(" @utbot.methodUnderTest {@link ${newClassName} #division(int, int)} " )
48+ assertThat(textEditor().editor.text).contains(" @utbot.methodUnderTest {@link ${newClassName} #" )
5349 assertThat(textEditor().editor.text).contains(returnsFromTagBody)
50+ // ToDo verify how many tests are generated
5451 // ToDo verify Problems view and Arithmetic exception on it
5552 }
5653 }
5754
5855 @ParameterizedTest(name = " Check Generate tests button is disabled in {0} project with unsupported JDK {1}" )
5956 @MethodSource(" unsupportedProjectsProvider" )
6057 @Tags(Tag (" Java" ), Tag (" UnitTestBot" ), Tag (" Negative" ))
61- fun checkTestGenerationIsUnavailable (ideaBuildSystem : IdeaBuildSystem , jdkVersion : JDKVersion ,
62- remoteRobot : RemoteRobot ) : Unit = with (remoteRobot ) {
58+ fun checkProjectWithUnsupportedJDK (ideaBuildSystem : IdeaBuildSystem , jdkVersion : JDKVersion ,
59+ remoteRobot : RemoteRobot ) {
6360 val createdProjectName = NEW_PROJECT_NAME_START + ideaBuildSystem.system + jdkVersion.number
6461 remoteRobot.welcomeFrame {
6562 findText(createdProjectName).click()
6663 }
6764 val ideaFrame = getIdeaFrameForBuildSystem(remoteRobot, ideaBuildSystem)
68- with (ideaFrame) {
65+ return with (ideaFrame) {
6966 val newClassName = " Arithmetic"
70- createNewJavaClass(newClassName, " org.example " )
67+ createNewJavaClass(newClassName, " Main " )
7168 textEditor().typeAdditionFunction(newClassName)
7269 openUTBotDialogFromProjectViewForClass(newClassName)
7370 assertThat(unitTestBotDialog.generateTestsButton.isEnabled().not ())
0 commit comments