Differences between sending parameters (Duration,target) from terminal and setting them into code

Hello all,

I am new in k6, I want to know what is differences between sending parameters (Duration, target) from terminal or sending them from code? we want to run our tests from terminal, but I think they have some differences.

I heard that running from terminal may lead to parallelized VUs but when we send our parameters from script, it lead to run serialize VUs

Thank you
I am waiting for your response

HI @elaheh.hasanzadeh,
welcome to the community forum :tada:

I think you mean the Stages option, as documented in the link, it’s a shortcut for a single scenario with a constant VUs executor.

As you mentioned, a single Option can be configured from the terminal or the code defining the properties in the options object. However, the same option defined from the terminal or from the code must lead to the same generated behaviour across the k6 logics. Instead, if you set in both places then you’ve to pay attention to the expected precedence order.

As the documentation defines here, is one of the goals of a VU to lead in a concurrent environment.

k6 works with the concept of virtual users (VUs), which run scripts - they’re essentially glorified, parallel while(true) loops.

In the summary, the expected behaviour of your performance tests is controlled from which specific options you set more than the place where they are set.