1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-18 05:18:24 +02:00

Merge branch 'master' into goGithub

This commit is contained in:
Oliver Nocon 2019-11-05 17:35:52 +01:00 committed by GitHub
commit 7b62775868
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 5 deletions

View File

@ -139,6 +139,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>fr.opensagres.js</groupId>
<artifactId>minimatch.java</artifactId>
<version>1.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -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

View File

@ -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/<browser>/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()
}