1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-16 11:09:33 +02:00
sap-jenkins-library/test/groovy/DurationMeasureTest.groovy
2019-01-23 14:54:50 +01:00

35 lines
896 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 stepRule = new JenkinsStepRule(this)
@Rule
public RuleChain rules = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
.around(stepRule)
@Test
void testDurationMeasurement() throws Exception {
def bodyExecuted = false
stepRule.step.durationMeasure(script: nullScript, measurementName: 'test') {
bodyExecuted = true
}
assertTrue(nullScript.commonPipelineEnvironment.getPipelineMeasurement('test') != null)
assertTrue(bodyExecuted)
assertJobStatusSuccess()
}
}