diff --git a/pom.xml b/pom.xml
index 6231dd661..5d9913115 100644
--- a/pom.xml
+++ b/pom.xml
@@ -139,6 +139,13 @@
test
+
+ fr.opensagres.js
+ minimatch.java
+ 1.1.0
+ test
+
+
diff --git a/resources/default_pipeline_environment.yml b/resources/default_pipeline_environment.yml
index f8b0c7b64..675ff6177 100644
--- a/resources/default_pipeline_environment.yml
+++ b/resources/default_pipeline_environment.yml
@@ -526,7 +526,7 @@ steps:
archive: false
active: false
cobertura:
- pattern: '**/target/coverage/cobertura-coverage.xml'
+ pattern: '**/target/coverage/**/cobertura-coverage.xml'
onlyStableBuilds: true
allowEmptyResults: true
archive: false
diff --git a/test/groovy/TestsPublishResultsTest.groovy b/test/groovy/TestsPublishResultsTest.groovy
index 3a4b9ff10..685bb3d24 100644
--- a/test/groovy/TestsPublishResultsTest.groovy
+++ b/test/groovy/TestsPublishResultsTest.groovy
@@ -12,6 +12,7 @@ import static org.junit.Assert.assertEquals
import static org.junit.Assert.assertTrue
import util.Rules
+import minimatch.Minimatch
class TestsPublishResultsTest extends BasePiperTest {
Map publisherStepOptions
@@ -90,14 +91,20 @@ class TestsPublishResultsTest extends BasePiperTest {
stepRule.step.testsPublishResults(script: nullScript, jacoco: true, cobertura: true)
assertTrue('JaCoCo options are empty', publisherStepOptions.jacoco != null)
- assertTrue('Cobertura options are empty', publisherStepOptions.cobertura != null)
assertEquals('JaCoCo default pattern not set correct',
'**/target/*.exec', publisherStepOptions.jacoco.execPattern)
- assertEquals('Cobertura default pattern not set correct',
- '**/target/coverage/cobertura-coverage.xml', publisherStepOptions.cobertura.coberturaReportFile)
// ensure nothing else is published
assertTrue('JUnit options are not empty', publisherStepOptions.junit == null)
assertTrue('JMeter options are not empty', publisherStepOptions.jmeter == null)
+
+ assertTrue('Cobertura options are empty', publisherStepOptions.cobertura != null)
+ assertTrue('Cobertura default pattern is empty', publisherStepOptions.cobertura.coberturaReportFile != null)
+ String sampleCoberturaPathForJava = 'my/workspace/my/project/target/coverage/cobertura-coverage.xml'
+ assertTrue('Cobertura default pattern does not match files at target/coverage/cobertura-coverage.xml for Java projects',
+ Minimatch.minimatch(sampleCoberturaPathForJava, publisherStepOptions.cobertura.coberturaReportFile))
+ String sampleCoberturaPathForKarma = 'my/workspace/my/project/target/coverage/Chrome 78.0.3904 (Mac OS X 10.14.6)/cobertura-coverage.xml'
+ assertTrue('Cobertura default pattern does not match files at target/coverage//cobertura-coverage.xml for UI5 projects',
+ Minimatch.minimatch(sampleCoberturaPathForKarma, publisherStepOptions.cobertura.coberturaReportFile))
}
@Test
@@ -145,7 +152,7 @@ class TestsPublishResultsTest extends BasePiperTest {
}]
}]
}
-
+
stepRule.step.testsPublishResults(script: nullScript)
assertJobStatusSuccess()
}