jeudi 4 juin 2020

Jmeter Variable from CSV

I am running a Jmeter Test Plan with an HTTP Request, to test the performance of a web service.

In my test, I need a variable named REF to be changed in the body data of my HTTP Request. REF can have 3000 values. So I have created a CSV file with all these 3000 values, a CSV Data Set Config, and a parameter in Jmeter named REF, and I use it in my HTTP Request like that :

<measure>
    <measureRef id="${REF}"></measureRef>
    <measureTime>${__time(yyyy-MM-dd'T'HH:mm:ss)}</measureTime>
    <measureVal>
        <value>${__Random(1,100,)}</value>
    </measureVal>
</measure>

As you can see it in this XML, I use the functions time and Random of Jmeter to have different requests everytime I run the test plan.

I would like yo run the test plan automatically for all the 3000 values of REF. To do that, I tried to configure the thread group like this : Number of Threads = 3000 and Loop Control = 1.

The problem is that the test takes 3 minutes to be done. So I would like to know if there is another way to do. The thing is that I need the test to be done for all the differents 3000 values in my CSV, and I don't see another way to do. I tried to put another measure in my Body Data, like this :

<measure>
    <measureRef id="${REF}"></measureRef>
    <measureTime>${__time(yyyy-MM-dd'T'HH:mm:ss)}</measureTime>
    <measureVal>
        <value>${__Random(1,100,)}</value>
    </measureVal>
</measure>
<measure>
    <measureRef id="${REF}"></measureRef>
    <measureTime>${__time(yyyy-MM-dd'T'HH:mm:ss)}</measureTime>
    <measureVal>
        <value>${__Random(1,100,)}</value>
    </measureVal>
</measure>

But the value of REF that is used this the same in the two measures, and what I want is to have different values picked in the CSV.

I also tried to configure the Thread Group like this : Number of Threads = 1 and Loop Control = 3000. But it's not working, I have a lot of errors...

I want the test to be runned quickly because to test my web service, I'd like to inject the 3000 values every 1 minute (by using a Flow Control Action maybe). And if the test runs in 3 minutes, I would be too long, and all the values would not be tested...

Thank you for your help !

Aucun commentaire:

Enregistrer un commentaire