Forum Discussion

lofi's avatar
lofi
New Contributor
15 years ago

Access messageExchange.timestamp in a groovy test script

Can I access it and how ?
  • lofi's avatar
    lofi
    New Contributor
    targetStep = messageExchange.modelItem.testStep.testCase.getTestStepByName('Properties')
    targetStep.setPropertyValue( 'timestamp', messageExchange.timestamp.toString())

    From there I can access it in a subsequent script test step.
  • lofi's avatar
    lofi
    New Contributor
    I forgot to mention that the 1st 2 rows must be placed in a script assertion of the response,
    which you want to save the timestamp from.

    Or is there an easier way ? The response itself does not contain a timestamp.
    In a subsequent groovy script test step I need to compare the request/response timestamp against a database entry.