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

35 lines
870 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 {
2018-02-28 14:11:09 +02:00
private JenkinsStepRule jsr = new JenkinsStepRule(this)
@Rule
2018-02-28 14:11:09 +02:00
public RuleChain rules = Rules
.getCommonRules(this)
.around(new JenkinsReadYamlRule(this))
2018-02-28 14:11:09 +02:00
.around(jsr)
@Test
void testDurationMeasurement() throws Exception {
def bodyExecuted = false
jsr.step.call(script: nullScript, measurementName: 'test') {
bodyExecuted = true
}
assertTrue(nullScript.commonPipelineEnvironment.getPipelineMeasurement('test') != null)
assertTrue(bodyExecuted)
assertJobStatusSuccess()
}
}