12

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.

Chintamani Manjare
  • 1,543
  • 1
  • 13
  • 28

1 Answers1

25

Below code is working for me.

"message": 
            {

            "order1": "{{ $randomString() }}",  
            "size": "{{$randomNumber(1,10000)}}",
            }   
Chintamani Manjare
  • 1,543
  • 1
  • 13
  • 28
  • 1
    You can use it when defining a variable as well: `variables: attributeName: "Testing{{ $randomNumber(100000,999999) }}"` – Joselo Jun 16 '22 at 13:14
  • god artillery's documentation is terrible. No mention of this anywhere afaict. It lives only in the examples folder in their github repo – Rooster Mar 28 '23 at 23:04
  • Check this file in the [artillery source code](https://github.com/artilleryio/artillery/blob/d71d1ee3ff49895334121f893375a56ecaa68cd2/packages/core/lib/runner.js#L421) as it has the `$randomString` and `$randomNumber` reference. – DogEatDog Jul 24 '23 at 13:16