mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
8a019f5b86
read yaml rule is a very frequently used rule. But having the rule in the common rules means we cannot register text or files to that rule, which makes it less handy to work with yaml files in the tests.
35 lines
870 B
Groovy
35 lines
870 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 jsr = new JenkinsStepRule(this)
|
|
|
|
@Rule
|
|
public RuleChain rules = Rules
|
|
.getCommonRules(this)
|
|
.around(new JenkinsReadYamlRule(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()
|
|
}
|
|
}
|