Stress testing with Pest with the new Stressless plugin

The PEST team just announced the release of a brand new plugin for Pest PHP: Stressless.

It's a fresh new addition to the Pest PHP family, and it brings the power of stress testing to the PHP ecosystem. It integrates seamlessly with Pest PHP, combining the power of stress testing with the simplicity and elegance of Pest's Expectation API.

Check out the YouTube video above in which Nuno Maduro, the creator of PEST, demonstrates the Stressless plugin.

It's effortless to get started with Stressless — all you need to do is require the package using Composer, and you're ready to go!

There are two main ways to use Stressless. You may use it to quickly stress test your application from the command line:

./vendor/bin/pest stress example.com --concurrency=5 --duration=10

Or you can use it to write stress tests in your Pest PHP test files:

<?php

test('black friday', function () {
    $result = stress('example.com')
        ->concurrently(5)
        ->for(10)->seconds();

    $requests = $result->requests;

    expect($requests->failed->count)
        ->toBe(0);

    expect($requests->duration->med)
        ->toBeLessThan(100.0); // 100ms
});

Check the documentation to get started with Stress Testing / Stressless: Stress Testing →.


The post Stress testing with Pest with the new Stressless plugin appeared first on Laravel News.

Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.

Read more

© 2024 Extly, CB - All rights reserved.