Random and Named Routes

Random usage warning

You have tried to save a test that uses random numbers or strings, but does not name all of it's test requests.

This is quick and easy to solve so do not worry. The reason for the error you received is the following:

  1. You have "import random" or "from random" in your test, meaning you are including a random element.
  2. You don't have a name variable attached to your GET and POST requests, meaning you could get millions of single logs

How to fix?

For example, you may have a request that looks like this:

self.client.get("/api/user/" + str(random.randint(0,100000)))

There is no problem with this, you want to test your User API with a random user ID between 0 and 100,000. However, these will then report as 100,000 different URLs you tested. That's not what you want, but also, will cause the test to be too large for our storage allowances.

By changing it to the following you will get them reported as a single clean result, and have no problems:

self.client.get("/api/user/" + str(random.randint(0,100000)), name="User API")

Other examples

Here is another example of naming a POST and GET route, to avoid the random limit:

response = self.client.post(
    json={"query": query }

self.client.get("/", name="Index Page")

If you are not actually using any random numbers or strings you can remove the "import random" from the top of your test script. Contact us at hello@loadforge.com if you believe the matching is incorrect or for any questions :)

Disable checking

Finally, you can tell LoadForge to ignore your usage of random and do the test anyway.

Simply add the following comment anywhere in your load test script and LoadForge will disable this check: