PHPackages                             pierstoval/smoke-testing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. pierstoval/smoke-testing

ActiveSymfony-bundle[Testing &amp; Quality](/categories/testing)

pierstoval/smoke-testing
========================

Smoke testing automator for Symfony applications

v1.2.7(2mo ago)4032.6k↓22.2%3[3 issues](https://github.com/Pierstoval/SmokeTesting/issues)LGPL-3.0-or-laterPHPPHP ^8.1CI failing

Since Aug 17Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/Pierstoval/SmokeTesting)[ Packagist](https://packagist.org/packages/pierstoval/smoke-testing)[ RSS](/packages/pierstoval-smoke-testing/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (30)Used By (0)

Smoke Testing with Symfony
==========================

[](#smoke-testing-with-symfony)

A very small lib meant to ease writing simple tests for your Symfony applications.

Particularly useful for big untested Symfony legacy projects.

This lib was originally inspired by a [tweet from @SmaineDev](https://twitter.com/SmaineDev/status/1559542937696043008), you can find him on [his Github (@ismail1432)](https://github.com/ismail1432) too.

**ℹ Note:** This library is compatible starting with PHP 8.1, Symfony 6.1 and PHPUnit 9.6, and is tested in almost all cases (almost...).
There are some unusual cases where it doesn't work entirely, but it will also depend on the rest of your stack, because some dependencies might induce incompatibilities with each other that are not tested (and possibly quite hard to test) in this package.
That said, if you want to help making this package compatible with lower versions of PHP and Symfony, to help legacy projects have at least a suite with smoke tests, feel free to open an issue or a PR!

Why smoke testing
-----------------

[](#why-smoke-testing)

[Smoke testing](https://en.wikipedia.org/wiki/Smoke_testing_(software)) is a way to quickly assert whether your project is viable for *unit* or *functional* testing.

To smoke-test an app, it is common to execute many parts of the app itself and just make sure it doesn't throw errors.

> An analogy could be that it is like starting the engine of your car to make sure it starts and doesn't throw smoke nor explode (hence "smoke" testing 😉), but not individually testing the windshield wipers, brake, or gear box.

In the world of web development, smoke testing is often about opening all pages of a website and making sure they don't return an HTTP server error (status code &gt; 500), and sometimes testing 404 or other HTTP client error codes.

Another **really important** use of smoke testing is when you work on big legacy projects that have no tests and/or no documentation.
Running basic smoke testing (like when using this library) **comes with a very low cost** and can **check the whole project's average health**.
Plus, adding **manual testing** (see the [Smoke-test routes manually](#-smoke-test-routes-manually) section) allows you to have **more control** and more **advanced settings** for your tests (such as adding HTTP headers, making expectations on page content, etc.).

Installation
------------

[](#installation)

```
composer require --dev pierstoval/smoke-testing

```

Usage
-----

[](#usage)

First, you need to configure PHPUnit for your application (see the [Testing](https://symfony.com/doc/current/testing.html) section on Symfony docs).

Now you have three choices to test your project:

- [Smoke testing all your routes at once](#-smoke-test-all-routes)
- [Smoke testing routes manually](#-smoke-test-routes-manually)
- [Smoke testing all your routes but with possible granular customization](#-smoke-test-all-routes-with-possible-granular-customization)

### 🌊 Smoke test ALL routes

[](#-smoke-test-all-routes)

- Create a test case.
- Make it extend `SmokeTestStaticRoutes`.
- Run PHPUnit.

Example:

```
