Skip to content
This repository was archived by the owner on Apr 2, 2021. It is now read-only.

Commit 7025dd9

Browse files
committed
Fix functional test infrastructure to work with Gradle 5 (#534)
1 parent 461a05b commit 7025dd9

27 files changed

+63
-19
lines changed

build.gradle

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
2222
*
2323
**********************************************************************************************************************/
2424
plugins {
25+
id 'java-gradle-plugin'
2526
id 'groovy'
2627
id 'maven'
2728
id 'idea'
@@ -46,6 +47,26 @@ ext {
4647
testCategory = project.hasProperty('TEST_CATEGORY') ? getProperty('TEST_CATEGORY') : null
4748
}
4849

50+
51+
/***********************************************************************************************************************
52+
*
53+
* Sources
54+
*
55+
**********************************************************************************************************************/
56+
57+
sourceSets {
58+
functionalTest {
59+
groovy {
60+
srcDir file('src/functionalTest/groovy')
61+
}
62+
resources {
63+
srcDir file('src/functionalTest/resources')
64+
}
65+
compileClasspath += sourceSets.main.output + configurations.testRuntime
66+
runtimeClasspath += output + compileClasspath
67+
}
68+
}
69+
4970
/***********************************************************************************************************************
5071
*
5172
* Repositories & Dependencies
@@ -111,7 +132,7 @@ idea {
111132
/**
112133
* Compiles the tests
113134
*/
114-
compileTestGroovy {
135+
compileFunctionalTestGroovy {
115136
classpath += configurations.proxyTest
116137
}
117138

@@ -195,12 +216,6 @@ groovydoc {
195216
*
196217
**********************************************************************************************************************/
197218

198-
/**
199-
* Configure test phase only to run ordinary unit tests.
200-
*/
201-
test {
202-
exclude '**/tests/**'
203-
}
204219

205220
/**
206221
* Run integration tests with a different tasks so they are only run when running check
@@ -219,6 +234,8 @@ task uncategorizedTests(type:Test, dependsOn:['test','jar']) {
219234
exclude '**/tests/*ProxyTest*'
220235
systemProperty 'integrationTestProjectVersion', version
221236
maxParallelForks = Runtime.runtime.availableProcessors() > 1 ? Runtime.runtime.availableProcessors() - 1 : 1
237+
testClassesDirs = sourceSets.functionalTest.output.classesDirs
238+
classpath = sourceSets.functionalTest.runtimeClasspath
222239
}
223240

224241
task widgetsetCompileTests(type:Test, dependsOn:['test','jar']) {
@@ -232,6 +249,8 @@ task widgetsetCompileTests(type:Test, dependsOn:['test','jar']) {
232249
}
233250
systemProperty 'integrationTestProjectVersion', version
234251
maxParallelForks = Runtime.runtime.availableProcessors() > 1 ? Runtime.runtime.availableProcessors() - 1 : 1
252+
testClassesDirs = sourceSets.functionalTest.output.classesDirs
253+
classpath = sourceSets.functionalTest.runtimeClasspath
235254
}
236255

237256
task themeCompileTests(type:Test, dependsOn:['test','jar']) {
@@ -245,6 +264,8 @@ task themeCompileTests(type:Test, dependsOn:['test','jar']) {
245264
}
246265
systemProperty 'integrationTestProjectVersion', version
247266
maxParallelForks = Runtime.runtime.availableProcessors() > 1 ? Runtime.runtime.availableProcessors() - 1 : 1
267+
testClassesDirs = sourceSets.functionalTest.output.classesDirs
268+
classpath = sourceSets.functionalTest.runtimeClasspath
248269
}
249270

250271
task fullCompileTests(type:Test, dependsOn:['test','jar']) {
@@ -257,6 +278,8 @@ task fullCompileTests(type:Test, dependsOn:['test','jar']) {
257278
}
258279
systemProperty 'integrationTestProjectVersion', version
259280
maxParallelForks = Runtime.runtime.availableProcessors() > 1 ? Runtime.runtime.availableProcessors() - 1 : 1
281+
testClassesDirs = sourceSets.functionalTest.output.classesDirs
282+
classpath = sourceSets.functionalTest.runtimeClasspath
260283
}
261284

262285
task runProjectTests(type:Test, dependsOn:['test','jar']) {
@@ -269,21 +292,35 @@ task runProjectTests(type:Test, dependsOn:['test','jar']) {
269292
}
270293
systemProperty 'integrationTestProjectVersion', version
271294
maxParallelForks = Runtime.runtime.availableProcessors() > 1 ? Runtime.runtime.availableProcessors() - 1 : 1
295+
testClassesDirs = sourceSets.functionalTest.output.classesDirs
296+
classpath = sourceSets.functionalTest.runtimeClasspath
272297
}
273298

274299
/**
275300
* Runs proxy integration test that needs special configuration
276301
*/
277302
task proxyTest(type:Test, dependsOn: ['test','jar']) {
278-
def oldClassPath = classpath
279-
classpath = configurations.proxyTest
280-
classpath += oldClassPath
281303
testLogging {
282304
exceptionFormat "full"
283305
showStandardStreams = true
284306
}
285307
include '**/tests/*ProxyTest*'
286308
systemProperty 'integrationTestProjectVersion', version
309+
testClassesDirs = sourceSets.functionalTest.output.classesDirs
310+
classpath += sourceSets.functionalTest.runtimeClasspath + configurations.proxyTest
311+
}
312+
313+
/**
314+
* Runs all the tests. Use this with --tests filter to run filtered tests in Idea.
315+
*/
316+
task allTests(type:Test, dependsOn:['test','jar']) {
317+
testLogging {
318+
exceptionFormat "full"
319+
showStandardStreams = true
320+
}
321+
systemProperty 'integrationTestProjectVersion', version
322+
testClassesDirs = sourceSets.functionalTest.output.classesDirs
323+
classpath = sourceSets.functionalTest.runtimeClasspath
287324
}
288325

289326
if(!ext.testCategory) {
@@ -336,6 +373,15 @@ plugins.withType(GroovyBasePlugin) {
336373
* Deployment
337374
*
338375
***********************************************************************************************************************/
376+
gradlePlugin {
377+
testSourceSets sourceSets.test
378+
plugins {
379+
vaadinPlugin {
380+
id = 'com.devsoap.plugin.vaadin'
381+
implementationClass = 'com.devsoap.plugin.GradleVaadinPlugin'
382+
}
383+
}
384+
}
339385

340386
pluginBundle {
341387
website = 'https://github.com/johndevs/gradle-vaadin-plugin/wiki'
@@ -344,7 +390,7 @@ pluginBundle {
344390
tags = ['vaadin', 'java', 'groovy', 'kotlin']
345391
plugins {
346392
vaadinPlugin {
347-
id = 'com.devsoap.plugin.vaadin'
393+
id = gradlePlugin.plugins.vaadinPlugin.id
348394
displayName = 'Gradle Vaadin plugin'
349395
}
350396
}

src/test/groovy/com/devsoap/plugin/categories/RunProject.groovy renamed to src/functionalTest/groovy/com/devsoap/plugin/categories/RunProject.groovy

File renamed without changes.

src/test/groovy/com/devsoap/plugin/categories/ThemeCompile.groovy renamed to src/functionalTest/groovy/com/devsoap/plugin/categories/ThemeCompile.groovy

File renamed without changes.

src/test/groovy/com/devsoap/plugin/categories/WidgetsetAndThemeCompile.groovy renamed to src/functionalTest/groovy/com/devsoap/plugin/categories/WidgetsetAndThemeCompile.groovy

File renamed without changes.

src/test/groovy/com/devsoap/plugin/categories/WidgetsetCompile.groovy renamed to src/functionalTest/groovy/com/devsoap/plugin/categories/WidgetsetCompile.groovy

File renamed without changes.

src/test/groovy/com/devsoap/plugin/tests/CompileWidgetsetTest.groovy renamed to src/functionalTest/groovy/com/devsoap/plugin/tests/CompileWidgetsetTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.devsoap.plugin.tests
22

3-
import com.devsoap.plugin.categories.ThemeCompile
3+
44
import com.devsoap.plugin.categories.WidgetsetCompile
55
import com.devsoap.plugin.tasks.CompileWidgetsetTask
66
import com.devsoap.plugin.tasks.CreateComponentTask

src/test/groovy/com/devsoap/plugin/tests/CreateAddonThemeTest.groovy renamed to src/functionalTest/groovy/com/devsoap/plugin/tests/CreateAddonThemeTest.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.devsoap.plugin.tests
33
import com.devsoap.plugin.tasks.CreateAddonThemeTask
44
import org.junit.Assert
55
import org.junit.Test
6-
import org.junit.experimental.categories.Category
76

87
import java.nio.file.Paths
98

src/test/groovy/com/devsoap/plugin/tests/CreateProjectTest.groovy renamed to src/functionalTest/groovy/com/devsoap/plugin/tests/CreateProjectTest.groovy

File renamed without changes.

src/test/groovy/com/devsoap/plugin/tests/CreateThemeTest.groovy renamed to src/functionalTest/groovy/com/devsoap/plugin/tests/CreateThemeTest.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import org.junit.runner.RunWith
99
import org.junit.runners.Parameterized
1010

1111
import java.nio.file.Paths
12-
import static org.junit.Assert.assertTrue
12+
1313
import static org.junit.Assert.assertFalse
14+
import static org.junit.Assert.assertTrue
1415

1516
/**
1617
* Created by john on 18.1.2016.

src/test/groovy/com/devsoap/plugin/tests/EclipseTest.groovy renamed to src/functionalTest/groovy/com/devsoap/plugin/tests/EclipseTest.groovy

File renamed without changes.

0 commit comments

Comments
 (0)