You can get Gatling up and running for load testing by either integrating it directly into your project or by installing it as a standalone package. This article provides step-by-step instructions on both options.
To integrate Gatling into your project, follow the steps below.
- Require the composer package:
composer require spryker-sdk/load-testing --dev
- Add the Router provider plugin to
src/Pyz/Yves/Router/RouterDependencyProvider.php
<?php
...
namespace Pyz\Yves\Router;
...
class RouterDependencyProvider extends SprykerRouterDependencyProvider
{
...
/**
* @return \Spryker\Yves\RouterExtension\Dependency\Plugin\RouteProviderPluginInterface[]
*/
protected function getRouteProvider(): array
{
...
if (class_exists(LoadTestingRouterProviderPlugin::class)) {
$routeProviders[] = new LoadTestingRouterProviderPlugin();
}
return $routeProviders;
}
...
}
- Make sure the
fixtures
command is enabled in the maincodeception.yml
:
...
extensions:
commands:
- \SprykerTest\Shared\Testify\Fixtures\FixturesCommand
...
That's it. The integration is complete.
Now that the integration part is done, you need to create and load the dummy data fixtures. To create and load the fixtures, do the following:
- Generate fixtures:
codecept fixtures -c vendor/spryker-sdk/load-testing
- Trigger all publish events:
console publish:trigger-events
- Run the queue worker:
console q:w:s -s
That being done, you should have the fixtures loaded into the databases.
After you have completed integration and prepared the fixtures, you install the Gatling tool. Do the following:
- Go to the tests directory:
cd vendor/spryker-sdk/load-testing
- Run
./install.sh
That's it! Now you have everything ready to perform the load testing for your project.
Besides integrating Gatling directly into your project, you can also install it as a standalone package. Do the following:
- Clone to the package directory and navigate to it:
git clone git@github.com:spryker-sdk/load-testing.git
cd load-testing
- Run the installation script:
./install.sh
Now you should have Gatling installed and ready for load testing.