简体   繁体   English

在 Jmeter 测试中排除数据的问题 CSV

[英]Issue with excluding a data in Jmeter Testing With CSV

I have an api Request such as this我有一个像这样的 api 请求

    "partnerServiceId":"${partnerServiceId}",
    "customerNo":"${customerNo}",
    "virtualAccountNo":"${virtualAccountNo}",
    "virtualAccountName":"${virtualAccountName}",
    "sourceAccountNo":"${sourceAccountNo}",
    "partnerReferenceNumber":"${partnerReferenceNumber}",
    "paidAmount":"${paidAmount}",
    "trxDateTime":"${trxDateTime}"

The First column partnerServiceId is not needed for this case.在这种情况下,不需要第一列 partnerServiceId。 So here is the sample csv I made, for one row.所以这里是我制作的样品 csv,一排。 I used ",,".我用了 ”,,”。

application/json,16786 f65a899b974397a0b7692cfde37ee0f953eb972b,,1282513558,112081000000000,Latifah Hanum,1901000000000,20211105018,10002.00,05/11/2021 08:44

Here is the variable setting I'm using in CSV Data Config这是我在 CSV 数据配置中使用的变量设置

Content-Type,Authorization,partnerServiceId,customerNo,virtualAccountNo,virtualAccountName,sourceAccountNo,sourceAccountNo,partnerReferenceNumber,paidAmount,trxDateTime

CSV 数据配置

The Result came out like结果出来像

Content-Type: application/json

Authorization: 16786 f65a899b974397a0b7692cfde37ee0f953eb972b

and for the request body对于请求正文

POST data: --RY0QSC1feIvTe02NIdE1n4T8bJi3bK3yiR---

Seems like only the headers came out right, what am I missing?似乎只有标题出来了,我错过了什么?

By default (with " Sharing mode " = All Threads ) CSV Data Set Config reads next line from the.CSV file on each iteration by each thread (virtual user)默认情况下(使用“ 共享模式”= All ThreadsCSV 数据集配置在每个线程的每次迭代中从 .CSV 文件中读取下一行(虚拟用户)

So if your CSV file really looks like:因此,如果您的 CSV 文件看起来像这样:

application/json,16786 
f65a899b974397a0b7692cfde37ee0f953eb972b,,1282513558,112081000000000,Latifah 
Hanum,1901000000000,20211105018,10002.00,05/11/2021 08:44

you won't be able to use all the data in one iteration, either move everything into one like like:您将无法在一次迭代中使用所有数据,或者将所有数据移到一个中,例如:

application/json,16786,f65a899b974397a0b7692cfde37ee0f953eb972b,,1282513558,112081000000000,Latifah Hanum,1901000000000,20211105018,10002.00,05/11/2021 08:44

or consider switching to __CSVRead() function where you have more or less full freedom regarding which column to read and when to proceed to the next line或考虑切换到__CSVRead() function ,您可以或多或少地完全自由地决定阅读哪一列以及何时继续下一行

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

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