Skip to content

Latest commit

 

History

History
111 lines (79 loc) · 2.52 KB

2-installing-gatling.md

File metadata and controls

111 lines (79 loc) · 2.52 KB

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.

Integrating Gatling into a project

To integrate Gatling into your project, follow the steps below.

  1. Require the composer package:
composer require spryker-sdk/load-testing --dev
  1. 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;
    }

    ...
}
  1. Make sure the fixtures command is enabled in the main codeception.yml:
...
extensions:
  commands:
    - \SprykerTest\Shared\Testify\Fixtures\FixturesCommand
...

That's it. The integration is complete.

Data preparation

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:

  1. Generate fixtures:
codecept fixtures -c vendor/spryker-sdk/load-testing
  1. Trigger all publish events:
console publish:trigger-events
  1. Run the queue worker:
console q:w:s -s 

That being done, you should have the fixtures loaded into the databases.

Installation

After you have completed integration and prepared the fixtures, you install the Gatling tool. Do the following:

  1. Go to the tests directory:
cd vendor/spryker-sdk/load-testing
  1. Run
./install.sh

That's it! Now you have everything ready to perform the load testing for your project.

Installing Gatling as a standalone package

Besides integrating Gatling directly into your project, you can also install it as a standalone package. Do the following:

  1. Clone to the package directory and navigate to it:
git clone git@github.com:spryker-sdk/load-testing.git
cd load-testing
  1. Run the installation script:
./install.sh

Now you should have Gatling installed and ready for load testing.

Next step

Running and using Gatling