Jmeter case structure

Body Data example

{ "universe": [ { "instrumentType": "ForwardRateAgreement", "instrumentDefinition": { "startDate": "${__RandomDate (, 2022-04-30, 2023-04-30,,)}", "fixedRatePercent" : 0.9, "endDate" : "${__RandomDate (, 2025-04-30, 2027-08-30,,)}", "notionalCcy" : "EUR", "indexName" : "EURIBOR," "interestCalculationMethod" : "Dcb_30_360", "indexTenor": "3M", "notionalAmount": ${__Random(1000000,9990000,)}}}, {"instrumentType": "ForwardRateAgreement", "instrumentDefinition": { "startDate": "${__RandomDate (, 2022-04-30, 2023-04-30,,)}", "fixedRatePercent" : 0.9, "endDate" : "${__RandomDate (, 2025-04-30, 2027-08-30,,)}", "notionalCcy" : "EUR", "indexName" : "EURIBOR," "interestCalculationMethod" : "Dcb_30_360", "indexTenor": "3M", "notionalAmount": ${__Random(1000000,9990000,)}}} {"instrumentType": "ForwardRateAgreement", "instrumentDefinition": { "startDate": "${__RandomDate (, 2022-04-30, 2023-04-30,,)}", "fixedRatePercent" : 0.9, "endDate" : "${__RandomDate (, 2025-04-30, 2027-08-30,,)}", "notionalCcy" : "EUR", "indexName" : "EURIBOR," "interestCalculationMethod" : "Dcb_30_360", "indexTenor": "3M", "notionalAmount": ${__Random(1000000,9990000,)}}}, {"instrumentType": "ForwardRateAgreement", "instrumentDefinition": { "startDate": "${__RandomDate (, 2022-04-30, 2023-04-30,,)}", "fixedRatePercent" : 0.9, "endDate" : "${__RandomDate (, 2025-04-30, 2027-08-30,,)}", "notionalCcy" : "EUR", "indexName" : "EURIBOR," "interestCalculationMethod" : "" indexTenor Dcb_30_360", ":" 3 m ", "notionalAmount" : ${__Random (1000000999000)}}}}]Copy the code

JSR233 PreProcessor

import java.text.SimpleDateFormat;
import java.util.Calendar;

calendar = Calendar.getInstance();
calendar.set(2019, 0, 1);
startTime = calendar.getTimeInMillis();
calendar.set(2020, 11, 31);
endTime = calendar.getTimeInMillis();
randomTime1 = startTime + (long)(Math.random()*(endTime-startTime));
randomTime2 = randomTime1 + (long)(180000000);

formatter = new SimpleDateFormat("yyyy-MM-dd");
calendar.setTimeInMillis(randomTime1);
vars.put("marketdataDate", formatter.format(calendar.getTime()));
log.info(formatter.format(calendar.getTime()));
calendar.setTimeInMillis(randomTime2);
vars.put("startDate", formatter.format(calendar.getTime()));
log.info(formatter.format(calendar.getTime()));
Copy the code