@@ -12,16 +12,15 @@ import org.utbot.data.NEW_PROJECT_NAME_START
12
12
import org.utbot.pages.*
13
13
import org.utbot.samples.typeAdditionFunction
14
14
import org.utbot.samples.typeDivisionFunction
15
- import java.time.Duration.ofMillis
16
15
import java.time.Duration.ofSeconds
17
16
18
17
class UnitTestBotActionTest : BaseTest () {
19
18
20
19
@ParameterizedTest(name = " Generate tests in {0} project with JDK {1}" )
21
20
@MethodSource(" supportedProjectsProvider" )
22
21
@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 ) {
25
24
val createdProjectName = NEW_PROJECT_NAME_START + ideaBuildSystem.system + jdkVersion.number
26
25
remoteRobot.welcomeFrame {
27
26
findText(createdProjectName).click()
@@ -36,36 +35,34 @@ class UnitTestBotActionTest : BaseTest() {
36
35
waitForIgnoringError (ofSeconds(5 )){
37
36
inlineProgressTextPanel.isShowing
38
37
}
39
- waitForIgnoringError(ofSeconds(60 ), ofMillis(100 )) {
40
- inlineProgressTextPanel.hasText(" Generate tests: read classes" )
41
- }
42
- waitForIgnoringError (ofSeconds(30 )){
38
+ waitForIgnoringError (ofSeconds(90 )){
43
39
inlineProgressTextPanel.hasText(" Generate test cases for class $newClassName " )
44
40
}
45
- waitForIgnoringError(ofSeconds(60 )) { // Can be changed to 60 for a complex class
41
+ waitForIgnoringError(ofSeconds(30 )) {
46
42
utbotNotification.title.hasText(" UnitTestBot: unit tests generated successfully" )
47
43
}
48
44
assertThat(textEditor().editor.text).contains(" class ${newClassName} Test" )
49
45
assertThat(textEditor().editor.text).contains(" @Test\n " )
50
46
assertThat(textEditor().editor.text).contains(" assertEquals(" )
51
47
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} #" )
53
49
assertThat(textEditor().editor.text).contains(returnsFromTagBody)
50
+ // ToDo verify how many tests are generated
54
51
// ToDo verify Problems view and Arithmetic exception on it
55
52
}
56
53
}
57
54
58
55
@ParameterizedTest(name = " Check Generate tests button is disabled in {0} project with unsupported JDK {1}" )
59
56
@MethodSource(" unsupportedProjectsProvider" )
60
57
@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 ) {
63
60
val createdProjectName = NEW_PROJECT_NAME_START + ideaBuildSystem.system + jdkVersion.number
64
61
remoteRobot.welcomeFrame {
65
62
findText(createdProjectName).click()
66
63
}
67
64
val ideaFrame = getIdeaFrameForBuildSystem(remoteRobot, ideaBuildSystem)
68
- with (ideaFrame) {
65
+ return with (ideaFrame) {
69
66
val newClassName = " Arithmetic"
70
67
createNewJavaClass(newClassName, " Main" )
71
68
textEditor().typeAdditionFunction(newClassName)
0 commit comments