1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/test/groovy/DurationMeasureTest.groovy
Christopher Fenner 10ec0473c1
correct step invokation in tests (#368)
* correct step invokation in tests

* correct step invokation in tests

* correct step invokation in tests
2018-11-07 11:45:38 +01:00

35 lines
881 B
Groovy

#!groovy
import org.junit.Rule
import org.junit.Test
import util.BasePiperTest
import static org.junit.Assert.assertTrue
import org.junit.rules.RuleChain
import util.Rules
import util.JenkinsReadYamlRule
import util.JenkinsStepRule
class DurationMeasureTest extends BasePiperTest {
private JenkinsStepRule jsr = new JenkinsStepRule(this)
@Rule
public RuleChain rules = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(jsr)
@Test
void testDurationMeasurement() throws Exception {
def bodyExecuted = false
jsr.step.durationMeasure(script: nullScript, measurementName: 'test') {
bodyExecuted = true
}
assertTrue(nullScript.commonPipelineEnvironment.getPipelineMeasurement('test') != null)
assertTrue(bodyExecuted)
assertJobStatusSuccess()
}
}