简体   繁体   English

JMeter:如何从今天到过去 10 天注入日期?

[英]JMeter: How to inject date from today till past 10 days?

There is a scenario where user will inject today's record, then yesterday's, then day before yesterday, likewise past 10 days.有一种情况,用户将注入今天的记录,然后是昨天的,然后是前天,同样是过去 10 天。

How may I achieve this?我怎样才能做到这一点?

You can use__timeShift() function which allows you to generate dates in past/future with arbitrary offsets in desired format:您可以使用__timeShift() function来生成过去/未来的日期,并以所需的格式使用任意偏移量:

  • Today: ${__timeShift(dd-MM-yyyy,,,,)}今天: ${__timeShift(dd-MM-yyyy,,,,)}
  • Yesterday: ${__timeShift(dd-MM-yyyy,,-P1D,,)}昨天: ${__timeShift(dd-MM-yyyy,,-P1D,,)}
  • The day before yesterday: ${__timeShift(dd-MM-yyyy,,-P2D,,)}前天: ${__timeShift(dd-MM-yyyy,,-P2D,,)}
  • etc.等等

在此处输入图像描述

More information: Creating Dates in JMeter Using the TimeShift Function更多信息: 使用 TimeShift 在 JMeter 中创建日期 Function

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM