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
Oliver Nocon f8e5733486 speed up tests
* use new base class for testing
* initialize jenkins unit test framework only once for all test classes
* minor test cleanups
2018-06-06 11:19:19 +02:00

31 lines
789 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.JenkinsStepRule
class DurationMeasureTest extends BasePiperTest {
private JenkinsStepRule jsr = new JenkinsStepRule(this)
@Rule
public RuleChain rules = Rules
.getCommonRules(this)
.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()
}
}