2018-09-21 16:55:31 +02:00
|
|
|
import static com.sap.piper.Prerequisites.checkScript
|
|
|
|
import groovy.transform.Field
|
|
|
|
|
2018-11-29 10:54:05 +02:00
|
|
|
@Field STEP_NAME = getClass().getName()
|
2018-09-21 16:55:31 +02:00
|
|
|
|
2018-01-24 10:55:38 +02:00
|
|
|
def call(Map parameters = [:], body) {
|
|
|
|
|
2018-09-21 16:55:31 +02:00
|
|
|
def script = checkScript(this, parameters)
|
|
|
|
|
2018-01-24 10:55:38 +02:00
|
|
|
def measurementName = parameters.get('measurementName', 'test_duration')
|
|
|
|
|
|
|
|
//start measurement
|
|
|
|
def start = System.currentTimeMillis()
|
|
|
|
|
|
|
|
body()
|
|
|
|
|
|
|
|
//record measurement
|
|
|
|
def duration = System.currentTimeMillis() - start
|
|
|
|
|
|
|
|
if (script != null)
|
|
|
|
script.commonPipelineEnvironment.setPipelineMeasurement(measurementName, duration)
|
|
|
|
|
|
|
|
return duration
|
|
|
|
}
|
|
|
|
|