@@ -9,21 +9,26 @@ plugins {
9
9
id(" toolkit-kotlin-conventions" )
10
10
id(" toolkit-intellij-plugin" )
11
11
12
- id(" org.jetbrains.intellij.platform" )
12
+ id(" org.jetbrains.intellij.platform.module " )
13
13
}
14
14
15
15
val ideProfile = IdeVersions .ideProfile(project)
16
16
val testPlugins by configurations.registering
17
- val testPrep by sourceSets.creating {
18
- java.srcDirs(findFolders(project, " tst-prep" , ideProfile))
19
- }
20
-
21
17
22
- // Add our source sets per IDE profile version (i.e. src-211)
23
18
sourceSets {
24
19
test {
25
- java.srcDirs(findFolders(project, " tst" , ideProfile))
26
- resources.srcDirs(findFolders(project, " tst-resources" , ideProfile))
20
+ java.setSrcDirs(findFolders(project, " tst-prep" , ideProfile))
21
+ resources.setSrcDirs(findFolders(project, " tst-resources" , ideProfile))
22
+ }
23
+ }
24
+
25
+ val uiTestSource = sourceSets.create(" uiTest" ) {
26
+ java.setSrcDirs(findFolders(project, " tst" , ideProfile))
27
+ }
28
+
29
+ idea {
30
+ module {
31
+ testSources.from(uiTestSource.allSource.srcDirs)
27
32
}
28
33
}
29
34
@@ -32,56 +37,57 @@ intellijPlatform {
32
37
instrumentCode = false
33
38
}
34
39
40
+ val uiTestImplementation by configurations.getting
35
41
42
+ configurations.getByName(uiTestSource.compileClasspathConfigurationName) {
43
+ extendsFrom(uiTestImplementation)
44
+ }
45
+
46
+ configurations.getByName(uiTestSource.runtimeClasspathConfigurationName) {
47
+ extendsFrom(uiTestImplementation)
48
+ }
36
49
37
50
dependencies {
38
- // testImplementation(platform("com.jetbrains.intellij.tools:ide-starter"))
39
51
// should really be set by the BOM, but too much work to figure out right now
40
- testImplementation(" org.kodein.di:kodein-di-jvm:7.20.2" )
41
- testImplementation(" org.junit.jupiter:junit-jupiter-api:5.10.0" )
42
- testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:5.10.0" )
43
-
44
- testImplementation(project(" :plugin-core:jetbrains-community" ))
45
- testImplementation(project(" :plugin-core:core" ))
46
- testImplementation(testFixtures(project(" :plugin-core:jetbrains-community" )))
47
- val testPrepImplementation by configurations.getting
48
-
49
- testPrepImplementation(testFixtures(project(" :plugin-core:jetbrains-community" )))
50
-
51
-
52
-
52
+ uiTestImplementation(" org.kodein.di:kodein-di-jvm:7.20.2" )
53
+ uiTestImplementation(platform(libs.junit5.bom))
54
+ uiTestImplementation(libs.junit5.jupiter)
53
55
54
56
intellijPlatform {
55
- // intellijIdeaCommunity(IdeVersions.ideProfile(providers).map { it.name })
56
- // intellijIdeaCommunity(ideProfile.community.sdkVersion)
57
57
val version = ideProfile.community.sdkVersion
58
58
intellijIdeaCommunity(version, ! version.contains(" SNAPSHOT" ))
59
- testFramework(TestFrameworkType .JUnit5 )
60
- testFramework(TestFrameworkType .Starter )
59
+
60
+ localPlugin(project(" :plugin-core" ))
61
+ testImplementation(project(" :plugin-core:core" ))
62
+ testImplementation(project(" :plugin-core:jetbrains-community" ))
63
+ testImplementation(testFixtures(project(" :plugin-core:jetbrains-community" )))
64
+
61
65
testFramework(TestFrameworkType .Bundled )
66
+ testFramework(TestFrameworkType .JUnit5 )
67
+
68
+ testFramework(TestFrameworkType .Starter , configurationName = uiTestImplementation.name)
62
69
}
63
70
64
71
testPlugins(project(" :plugin-amazonq" , " pluginZip" ))
65
72
testPlugins(project(" :plugin-core" , " pluginZip" ))
66
73
}
67
74
68
- val prepareAmazonQTest = tasks.register<Test >(" prepareAmazonQTest" ) {
69
- // dependsOn(":plugin-core:jetbrains-community:test:abc")
70
- // filter {
71
- // setIncludePatterns("abc.*")
72
- // //includeTestsMatching("abc.AbcTest")
73
- // //excludeTestsMatching("software.aws.toolkits.jetbrains.*")
74
- // }
75
- testClassesDirs = testPrep.output.classesDirs
76
- classpath = testPrep.runtimeClasspath
77
-
78
- useJUnitPlatform()// Assuming your test task is named amazonQTest
75
+ tasks.test {
76
+ enabled = false
77
+ }
78
+
79
+ val prepareAmazonQTest by intellijPlatformTesting.testIde.registering {
80
+ task {
81
+ useJUnitPlatform()
82
+ }
79
83
}
80
84
81
- tasks.test {
82
- dependsOn(testPlugins)
85
+ tasks.register<Test >(" uiTest" ) {
86
+ testClassesDirs = uiTestSource.output.classesDirs
87
+ classpath = uiTestSource.runtimeClasspath
88
+
83
89
dependsOn(prepareAmazonQTest)
84
- useJUnitPlatform( )
90
+ dependsOn(testPlugins )
85
91
86
92
systemProperty(" ui.test.plugins" , testPlugins.get().asPath)
87
93
}
0 commit comments