From e5b8b02aa1e3a23dc17f0e0d19cbebe4b3e0d06d Mon Sep 17 00:00:00 2001 From: Vincenzo Petrucci Date: Wed, 6 Dec 2023 14:54:40 +0100 Subject: [PATCH 1/2] feat(methods): documented usage of delete, head, options, patch and put methods/options --- stress-testing.md | 49 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/stress-testing.md b/stress-testing.md index 4965f0a..246aeda 100644 --- a/stress-testing.md +++ b/stress-testing.md @@ -53,9 +53,30 @@ The concurrency value represents the number of concurrent requests that will be You may want to be mindful of the number of concurrent requests you configure. If you configure too many concurrent requests, you may overwhelm your application, server or hit rate limits / firewalls. -If you want to specify the http method used for the stress test, you can use the provided `get` and `post` options. Using the `--post` option, you can specify as argument the payload to be used in the requests: +If you want to specify the http method used for the stress test, you can use one of the provided `delete`, `get`, `head`, `options`, `patch`, `put` or `post` options. + +Using `options`, `patch` and `put` options, you can specify an optional payload argument to be used in the requests. +Using `post` option, you are required to provide the payload argument. ```bash +./vendor/bin/pest stress example.com/articles/1 --delete +# or +./vendor/bin/pest stress example.com/articles --get +# or +./vendor/bin/pest stress example.com/articles --head +# or +./vendor/bin/pest stress example.com/articles --options +# or +./vendor/bin/pest stress example.com/articles --options='{"name": "Nuno"}' +# or +./vendor/bin/pest stress example.com/articles/1 --patch +# or +./vendor/bin/pest stress example.com/articles/1 --patch='{"name": "Nuno"}' +# or +./vendor/bin/pest stress example.com/articles --put +# or +./vendor/bin/pest stress example.com/articles --put='{"name": "Nuno"}' +# or ./vendor/bin/pest stress example.com/articles --post='{"name": "Nuno"}' ``` @@ -100,16 +121,32 @@ $result = stress('example.com')->dd(); //->verbosely(); ``` -If you want to specify the http method used for the stress test, you can use the provided `get` and `post` methods. +If you want to specify the http method used for the stress test, you can use one of the provided `delete`, `get`, `head`, `options`, `patch`, `put` or `post` methods. +Using `options`, `patch` and `put` methods, you can specify an optional payload argument to be used in the requests. +Using `post` method, you are required to provide the payload argument. ```php -$result = stress('example.com')->get(); +$result = stress('example.com/articles/1')->delete(); +// or +$result = stress('example.com/articles')->get(); +// or +$result = stress('example.com/articles')->head(); +// or +$result = stress('example.com/articles')->options(); +// or +$result = stress('example.com/articles')->options(["name" => "Nuno"]); // or -$result = stress('example.com')->post(['name' => 'Nuno']); +$result = stress('example.com/articles/1')->patch(); +// or +$result = stress('example.com/articles/1')->patch(["name" => "Nuno"]); +// or +$result = stress('example.com/articles')->put(); +// or +$result = stress('example.com/articles')->put(["name" => "Nuno"]); +// or +$result = stress('example.com/articles')->post(["name" => "Nuno"]); ``` -If you are using the POST http method, remember to pass to the `post` method the payload to be used in the requests. - The `stress()` function return the stress test result, which you can use to set expectations. Here is the list of available methods: From d94abd1bd0e71403bb5a327dbfa5b2656b435dc3 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Wed, 6 Dec 2023 14:31:30 +0000 Subject: [PATCH 2/2] Update stress-testing.md --- stress-testing.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stress-testing.md b/stress-testing.md index 246aeda..78302ae 100644 --- a/stress-testing.md +++ b/stress-testing.md @@ -53,13 +53,10 @@ The concurrency value represents the number of concurrent requests that will be You may want to be mindful of the number of concurrent requests you configure. If you configure too many concurrent requests, you may overwhelm your application, server or hit rate limits / firewalls. -If you want to specify the http method used for the stress test, you can use one of the provided `delete`, `get`, `head`, `options`, `patch`, `put` or `post` options. - -Using `options`, `patch` and `put` options, you can specify an optional payload argument to be used in the requests. -Using `post` option, you are required to provide the payload argument. +If you want to specify the http method used for the stress test, you can use one of the provided `delete`, `get`, `head`, `options`, `patch`, `put` or `post` options. Using `options`, `patch` and `put` options, you can specify an optional payload argument to be used in the requests. Using `post` option, you are required to provide the payload argument. ```bash -./vendor/bin/pest stress example.com/articles/1 --delete +./vendor/bin/pest stress example.com/articles # or ./vendor/bin/pest stress example.com/articles --get # or @@ -78,6 +75,9 @@ Using `post` option, you are required to provide the payload argument. ./vendor/bin/pest stress example.com/articles --put='{"name": "Nuno"}' # or ./vendor/bin/pest stress example.com/articles --post='{"name": "Nuno"}' +# or +./vendor/bin/pest stress example.com/articles/1 --delete + ``` Once the stress test is completed, Pest will display a summary of the stress test result.