mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
f8e5733486
* use new base class for testing * initialize jenkins unit test framework only once for all test classes * minor test cleanups
31 lines
789 B
Groovy
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()
|
|
}
|
|
}
|