Setting up global parameters


I am exploring ways to initiate tests on k6 without the need to set the url in each test run.
For example, I need to set the prometheus remote write url every time when I run the test. But the prometheus URL is not changing unless its a different env. So I want to know if there is a way to setup the URL as global variable and whenever I run the test I don’t need to specify the URL. Is that possible?

Hi @saurabh.dwivedi, welcome to the community forum!

Not certain what you are asking specifically but the documentation you have linked to uses environment variables to configure k6.

As such you can just set them globally. The ones in the examples are set only for that 1 command.

I can recommend this article for some more information on env variables and how to set them including globally.

If that wasn’t your question, can I get some more information as I am not getting it then :(.

1 Like