Download the PHP package liuggio/fastest without Composer

On this page you can find all versions of the php package liuggio/fastest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fastest

Fastest - simple parallel testing execution

example branch parameter Latest Stable Version Latest Unstable Version

Only one thing

Execute parallel commands, creating a Process for each Processor (with some goodies for functional tests).

Fastest works with any available testing tool! It just executes it in parallel.

It is optimized for functional tests, giving an easy way to work with N databases in parallel.

Motto

"I had a problem,
so I decided to use threads.
tNwoowp rIo bhlaevmes.

Why

We were tired of not being able to run paratest with our project (big complex functional project).
Parallel is a great tool but not so nice for functional tests.
There were no simple tool available for functional tests.

Our old codebase run in 30 minutes, now in 7 minutes with 4 Processors.

Features

  1. Functional tests could use a database per processor using the environment variable.
  2. Tests are randomized by default.
  3. Is not coupled with PhpUnit you could run any command.
  4. Is developed in PHP with no dependencies.
  5. As input you could use a phpunit.xml.dist file or use pipe (see below).
  6. Includes a Behat extension to easily pipe scenarios into fastest.
  7. Increase Verbosity with -v option.
  8. Works with a installation in project or global mode

How

It creates N threads where N is the number of the core in the computer.
Really fast, 100% written in PHP, inspired by Parallel.

Usage

Configure paths to binaries

Examples shown below use paths to binaries installed in the vendor/ directory. You can use symlinks in the bin/ directory by defining the bin-dir parameter of Composer:

Then you'll be able to call binaries in the bin/ directory:

Parallelize everything

Using the placeholders

{} is the current test file.
{p} is the current processor number.
{n} is the unique number of the current test. phpunit {} is used as default command.

PHPUnit

A. Using ls, list of folders as input suggested

B. using find, list of php files as input

C. Using phpunit.xml.dist as input

You can use the option -x and import the test suites from the phpunit.xml.dist

./vendor/liuggio/fastest/fastest -x phpunit.xml.dist "vendor/phpunit/phpunit/phpunit {};"

If you use this option make sure the test-suites contains a lot of directories: this feature should be improved, don't blame help instead.

Functional tests and database

Inside your tests you could use the env. variables,
if you are running tests on a computer that has 4 core, fastest will create 4 threads in parallel, and inside your test you could use those variables to better identify the current process:

Setup the database before

You can also run a script per process before the tests, useful for init schema and fixtures loading.

Generate and merge code coverage

Code coverage will be available in the cov/merge/fastest/ directory.

Storage adapters

If you want to parallel functional tests, and if you have a machine with 4 CPUs, the best thing you could do is create a db foreach parallel process, fastest gives you the opportunity to work easily with Symfony.

Modifying the config_test.yml config file in Symfony, each functional test will look for a database called <database_name>_test_x automatically (x is from 1 to CPUs number).

Doctrine DBAL

config_test.yml

Doctrine MongoDB Connection

config_test.yml

SQLite databases

SQLite databases don't have names. It's always 1 database per file. If SQLite driver is detected, instead switching the database name, database path will be changed. To make it work simply add __DBNAME__ placeholder in your database path.

config_test.yml

Where __DBNAME__ will be replaced with ENV_TEST_CHANNEL_READABLE value.

Behat.* extension

A Behat extension is included that provides the ability for Behat to output a list of feature files or individual scenarios that would be executed without actually executing them. This list can be piped into fastest to run the scenarios in parallel.

To install the extension just add it to your behat.yml file:

for Behat2:

After this you will have two additional command line options: --list-features and --list-scenarios. The former will output a list of *.feature files and the later will output each scenario of each feature file, including its line number (e.g. /full/path/Features/myfeature.feature:lineNumber)

This will let you pipe the output directly into fastest to parallelize its execution:

/my/path/behat --list-scenarios | ./vendor/liuggio/fastest/fastest "/my/path/behat {}"

Using --list-scenarios is preferred over --list-features because it will give a more granular scenario-by-scenario output, allowing fastest to shuffle and balance individual tests in a better way.

About browser-based tests (Selenium, Mink, etc)

When a browser is controlled remotely via PHPUnit, Behat or another test suite that is being used by Fastest, the browser makes requests back to the server. The problem is that when the server process the request it has no idea of which fastest channel called it, so there must be a way to set this information before connecting to the database (in order to choose the correct database that corresponds to the channel).

One possible way is to implement the following steps:

1. Set a cookie, GET query parameter or HTTP header with the appropiate channel value

When your test scenario begins, maybe at the authentication phase, set one of the following to the value of the environment variable ENV_TEST_CHANNEL_READABLE:

2. Configure the entry point of your application to set the environment variables for the request

For this is enough to add the following code before booting your application:

\Liuggio\Fastest\Environment\FastestEnvironment::setFromRequest();

This will detect the presence of the ENV_TEST_CHANNEL_READABLE value in any of the contexts mentioned in #1 and set the corresponding environment variable.

For example, in the case of the Symfony framework you may just add it in web/app_dev.php just before require_once __DIR__.'/../app/AppKernel.php':

Install

If you use Composer just run composer require --dev 'liuggio/fastest:^1.6'

or simply add a dependency on liuggio/fastest to your project's composer.json file:

{
    "require-dev": {
        "liuggio/fastest": "^1.6"
    }
}

For a system-wide installation via Composer, you can run:

composer global require "liuggio/fastest=^1.6"

Make sure you have ~/.composer/vendor/bin/ in your path, read more at getcomposer.org

If you want to use it with phpunit you may want to install phpunit/phpunit as dependency.

Run this test with fastest

e.g. ./fastest -x phpunit.xml.dist -v "bin/phpunit {}"

Known problems

If you're faceing problems with unknown command errors, make sure your variables-order php.ini setting contains E. If not, your enviroment variables are not set, and commands that are in your PATH will not work.

Contribution

Please help with code, love, feedback and bug reporting.

Thanks to:

License License

Read LICENSE for more information.


All versions of fastest with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
symfony/console Version ^5.4|^6.0|^7.0
symfony/stopwatch Version ^5.4|^6.0|^7.0
symfony/process Version ^5.4|^6.0|^7.0
doctrine/collections Version ^1.2|^2.0
symfony/deprecation-contracts Version ^2.1|^3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package liuggio/fastest contains the following files

Loading the files please wait ....