This is an automated email from the ASF dual-hosted git repository. benweidig pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
commit 8a640f34a5b42772a3db3cad2b28d3c303f2694f Author: Ben Weidig <[email protected]> AuthorDate: Sat Apr 18 11:26:36 2026 +0200 TAP5-2809/2819: Integration testing streamlined Repetitive tasks in tapestry-core build.gradle and Jenkinsfile.integration-variants simplified. Preparations for future Gradle 9 update. --- Jenkinsfile.integration-variants | 47 +++++-------- .../groovy/tapestry.testing-base-convention.gradle | 11 +-- tapestry-core/build.gradle | 79 ++++++++++++---------- 3 files changed, 66 insertions(+), 71 deletions(-) diff --git a/Jenkinsfile.integration-variants b/Jenkinsfile.integration-variants index f68446d0a..150cac8bd 100644 --- a/Jenkinsfile.integration-variants +++ b/Jenkinsfile.integration-variants @@ -31,16 +31,7 @@ pipeline { } post { always { - sh ''' - if [ -d "tapestry-core/build/test-results/testWithPrototypeAndRequireJsDisabled" ]; then - find tapestry-core/build/test-results/testWithPrototypeAndRequireJsDisabled -name "*.xml" -type f -exec sed -i 's/classname="org\./classname="Prototype.org./g' {} + - fi - ''' - - junit( - testResults: 'tapestry-core/build/test-results/testWithPrototypeAndRequireJsDisabled/**/*.xml', - allowEmptyResults: true - ) + prefixAndPublishTestResults('testWithPrototypeAndRequireJsDisabled', 'Prototype') } } } @@ -56,16 +47,7 @@ pipeline { } post { always { - sh ''' - if [ -d "tapestry-core/build/test-results/testWithJqueryAndRequireJsDisabled" ]; then - find tapestry-core/build/test-results/testWithJqueryAndRequireJsDisabled -name "*.xml" -type f -exec sed -i 's/classname="org\./classname="Jquery.org./g' {} + - fi - ''' - - junit( - testResults: 'tapestry-core/build/test-results/testWithJqueryAndRequireJsDisabled/**/*.xml', - allowEmptyResults: true - ) + prefixAndPublishTestResults('testWithJqueryAndRequireJsDisabled', 'jQuery') } } } @@ -81,16 +63,7 @@ pipeline { } post { always { - sh ''' - if [ -d "tapestry-core/build/test-results/testWithPrototypeAndRequireJsEnabled" ]; then - find tapestry-core/build/test-results/testWithPrototypeAndRequireJsEnabled -name "*.xml" -type f -exec sed -i 's/classname="org\./classname="PrototypeRjs.org./g' {} + - fi - ''' - - junit( - testResults: 'tapestry-core/build/test-results/testWithPrototypeAndRequireJsEnabled/**/*.xml', - allowEmptyResults: true - ) + prefixAndPublishTestResults('testWithPrototypeAndRequireJsEnabled', 'PrototypeRjs') } } } @@ -106,6 +79,20 @@ pipeline { } } +// TEST RESULTS + +def prefixAndPublishTestResults(testName, prefix) { + sh """ + if [ -d "tapestry-core/build/test-results/${testName}" ]; then + find tapestry-core/build/test-results/${testName} -name "*.xml" -type f -exec sed -i 's/classname="org[.]/classname="${prefix}.org./g' {} + + fi + """ + junit( + testResults: "tapestry-core/build/test-results/${testName}/**/*.xml", + allowEmptyResults: true + ) +} + // MAIL NOTIFICATIONS def getChangeLog() { diff --git a/buildSrc/src/main/groovy/tapestry.testing-base-convention.gradle b/buildSrc/src/main/groovy/tapestry.testing-base-convention.gradle index 58cff9d52..c4f1a1f06 100644 --- a/buildSrc/src/main/groovy/tapestry.testing-base-convention.gradle +++ b/buildSrc/src/main/groovy/tapestry.testing-base-convention.gradle @@ -12,6 +12,9 @@ // The JUnit BOM ensures all JUnit Platform artifacts (launcher, engines) use the same version, // even in modules that only use TestNG and never write a single @Test(jupiter) method. +import org.gradle.api.tasks.testing.logging.TestExceptionFormat +import org.gradle.api.tasks.testing.TestResult.ResultType + plugins { id 'java-library' } @@ -38,7 +41,7 @@ tasks.withType(Test).configureEach { testTask -> environment.LANG = 'en_US.UTF-8' testLogging { - exceptionFormat 'full' + exceptionFormat = TestExceptionFormat.FULL events 'passed', 'skipped', 'failed' showStandardStreams = true } @@ -49,13 +52,13 @@ tasks.withType(Test).configureEach { testTask -> afterTest { descriptor, result -> switch (result.resultType) { - case org.gradle.api.tasks.testing.TestResult.ResultType.SUCCESS: + case ResultType.SUCCESS: passed++ break - case org.gradle.api.tasks.testing.TestResult.ResultType.FAILURE: + case ResultType.FAILURE: failed++ break - case org.gradle.api.tasks.testing.TestResult.ResultType.SKIPPED: + case ResultType.SKIPPED: skipped++ break } diff --git a/tapestry-core/build.gradle b/tapestry-core/build.gradle index d4d837b3e..a5bdb253b 100644 --- a/tapestry-core/build.gradle +++ b/tapestry-core/build.gradle @@ -119,10 +119,14 @@ test { // This task runs the default integration tests that are defined in the testng.xml tasks.register('testNG', Test) { group = 'verification' + classpath = sourceSets.test.runtimeClasspath useTestNG { suiteXmlFiles << project.file('src/test/resources/testng.xml') } + + // TAP5-2722 + systemProperty 'user.language', 'en' } tasks.named('check') { @@ -152,43 +156,44 @@ tasks.named('check') { // These three tasks exercise the other combinations. They are NOT wired into 'check' // and run only via the 'continuousIntegration' task in the root build. -tasks.register('testWithJqueryAndRequireJsDisabled', Test) { - group = 'verification' - description = 'Runs tests with jQuery and Require.js disabled' - - useTestNG() - - systemProperties( - 'tapestry.javascript-infrastructure-provider': 'jquery', - 'tapestry.require-js-enabled': 'false', - 'tapestry.port': '9091', - 'tapestry.ssl-port': '8444' - ) -} - -tasks.register('testWithPrototypeAndRequireJsEnabled', Test) { - group = 'verification' - description = 'Runs tests with Prototype and Require.js enabled' - useTestNG() - - systemProperties( - 'tapestry.javascript-infrastructure-provider': 'prototype', - 'tapestry.require-js-enabled': 'true', - 'tapestry.port': '9092', - 'tapestry.ssl-port': '8445' - ) -} - -tasks.register('testWithPrototypeAndRequireJsDisabled', Test) { - group = 'verification' - description = 'Runs tests with Prototype and Require.js disabled' +[ + [ + name: 'testWithJqueryAndRequireJsDisabled', + provider: 'jquery', + requireJs: 'false', + port: '9091', + sslPort: '8444' + ], + [ + name: 'testWithPrototypeAndRequireJsEnabled', + provider: 'prototype', + requireJs: 'true', + port: '9092', + sslPort: + '8445' + ], + [ + name: 'testWithPrototypeAndRequireJsDisabled', + provider: 'prototype', + requireJs: 'false', + port: '9093', + sslPort: '8446' + ] +].each { cfg -> + tasks.register(cfg.name, Test) { + group = 'verification' + description = "Runs integration tests with ${cfg.provider} and RequireJS ${cfg.requireJs == 'true' ? 'enabled' : 'disabled'}" + classpath = sourceSets.test.runtimeClasspath - useTestNG() + useTestNG { + suiteXmlFiles << project.file('src/test/resources/testng.xml') + } - systemProperties( - 'tapestry.javascript-infrastructure-provider': 'prototype', - 'tapestry.require-js-enabled': 'false', - 'tapestry.port': '9093', - 'tapestry.ssl-port': '8446' - ) + systemProperties( + 'tapestry.javascript-infrastructure-provider': cfg.provider, + 'tapestry.require-js-enabled': cfg.requireJs, + 'tapestry.port': cfg.port, + 'tapestry.ssl-port': cfg.sslPort + ) + } }
