From 67164858819821ba33580be14738420a05388c31 Mon Sep 17 00:00:00 2001 From: Vincenzo Petrucci Date: Sun, 26 Nov 2023 16:44:20 +0100 Subject: [PATCH 1/2] feat(methods): Documented stressless new option to specify the http method --- stress-testing.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/stress-testing.md b/stress-testing.md index be6414e..58b1d5f 100644 --- a/stress-testing.md +++ b/stress-testing.md @@ -53,6 +53,20 @@ 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. + +```bash +./vendor/bin/pest stress example.com --get +``` + +or + +```bash +./vendor/bin/pest stress example --post='{"name": "Nuno"}' +``` + +Using the `--post` option, you can specify as argument the payload to be used in the requests. + Once the stress test is completed, Pest will display a summary of the stress test result. @@ -94,6 +108,15 @@ $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. + +```php +$result = stress('example.com')->get(); +// or +$result = stress('example.com')->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 f94664db07183f171794948451a21a4bddedd443 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 27 Nov 2023 10:28:54 +0000 Subject: [PATCH 2/2] Update stress-testing.md --- stress-testing.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/stress-testing.md b/stress-testing.md index 58b1d5f..769ccf2 100644 --- a/stress-testing.md +++ b/stress-testing.md @@ -53,20 +53,12 @@ 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. - -```bash -./vendor/bin/pest stress example.com --get -``` - -or +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: ```bash ./vendor/bin/pest stress example --post='{"name": "Nuno"}' ``` -Using the `--post` option, you can specify as argument the payload to be used in the requests. - Once the stress test is completed, Pest will display a summary of the stress test result.