1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/test/groovy/DurationMeasureTest.groovy

35 lines
896 B
Groovy
Raw Normal View History

#!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
2018-02-28 14:11:09 +02:00
import util.JenkinsStepRule
class DurationMeasureTest extends BasePiperTest {
2019-01-22 10:25:42 +02:00
private JenkinsStepRule stepRule = new JenkinsStepRule(this)
@Rule
2018-02-28 14:11:09 +02:00
public RuleChain rules = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
2019-01-22 10:25:42 +02:00
.around(stepRule)
@Test
void testDurationMeasurement() throws Exception {
def bodyExecuted = false
2019-01-22 10:25:42 +02:00
stepRule.step.durationMeasure(script: nullScript, measurementName: 'test') {
bodyExecuted = true
}
assertTrue(nullScript.commonPipelineEnvironment.getPipelineMeasurement('test') != null)
assertTrue(bodyExecuted)
assertJobStatusSuccess()
}
}