Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create random string or Number in artillery load testing script?

For bombarding the server with multiple request with random data in parameters, how can I do it?

the message block in artillery script is as below,

    "message": 
                {

                "order1": "jngfj2434",  
                "size": "4433",
                }   

I need to send order1 with randomstring and size in the range of 1 to 10,000 randomly.

like image 921
Chintamani Manjare Avatar asked Jan 04 '18 13:01

Chintamani Manjare


People also ask

How do you generate random strings in Load Runner?

Sometimes it's necessary to generate a random string, number, or UUID/GUID in your load test script. To do this, you can call any of these functions: randomalpha(len) - Generates a random alphabetic string of the specified length (consisting of all ASCII letters).

Where can we set header in artillery?

You can set your headers in default parameter inside config like this: config: target: "http://localhost:3000" phases: - duration: 10 arrivalRate: 100 defaults: headers: authorization: token ...

What are the kind of phases in artillery?

Four kinds of phases are supported: A phase with a duration and a constant arrival rate of a number of new VUs per second. A linear ramp-up phase where the number of new arrivals increases linearly over time. A phase that generates a fixed count of new arrivals over a period of time.


1 Answers

Below code is working for me.

"message": 
            {

            "order1": "{{ $randomString() }}",  
            "size": "{{$randomNumber(1,10000)}}",
            }   
like image 114
Chintamani Manjare Avatar answered Oct 16 '22 17:10

Chintamani Manjare