Download the PHP package allure-framework/allure-phpunit without Composer

On this page you can find all versions of the php package allure-framework/allure-phpunit. 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 allure-phpunit

Allure PHPUnit adapter

Latest Stable Version Build Type Coverage Psalm Level Total Downloads License

This an official PHPUnit adapter for Allure Framework - a flexible, lightweight and multi-language framework for writing self-documenting tests.

Table of Contents

What is this for?

The main purpose of this adapter is to accumulate information about your tests and write it out to a set of JSON files: one for each test class. Then you can use a standalone command line tool or a plugin for popular continuous integration systems to generate an HTML page showing your tests in a good form.

Examples

Please take a look at these example tests.

How to generate report

This adapter only generates JSON files containing information about tests. See wiki section on how to generate report.

Installation && Usage

Note: this adapter supports Allure 2.x.x only.

Supported PHP versions: 8.1-8.3.

In order to use this adapter you need to add a new dependency to your composer.json file:

Then add Allure test listener in phpunit.xml file:

Config is common PHP file that should return an array:

After running PHPUnit tests a new folder will be created (build/allure-results in the example above). This folder will contain generated JSON files. See framework help for details about how to generate report from JSON files. By default generated report will only show a limited set of information but you can use cool Allure features by adding a minimum of test code changes. Read next section for details.

Main features

This adapter comes with a set of PHP annotations and traits allowing to use main Allure features.

Human-readable test class or test method title

In order to add such title to any test class or test case method you need to annotate it with #[DisplayName] annotation:

Extended test class or test method description

Similarly you can add detailed description for each test class and test method. To add such description simply use #[Description] annotation:

Description can be added in Markdown format (which is default one) or in HTML format. For HTML simply pass true value for optional isHtml argument.

Set test severity

#[Severity] annotation is used in order to prioritize test methods by severity:

Specify test parameters information

In order to add information about test method parameters you should use #[Parameter] annotation. You can also use static shortcut if your marameter has dynamic value:

Map test classes and test methods to features and stories

In some development approaches tests are classified by stories and features. If you're using this then you can annotate your test with #[Story] and #[Feature] annotations:

You will then be able to filter tests by specified features and stories in generated Allure report.

Attach files to report

If you wish to attach some files generated during PHPUnit run (screenshots, log files, dumps and so on) to report - then you need to use static shortcuts in your test class:

In order to create an attachment simply call Allure::attachment() method. This method accepts human-readable name, string content and MIME attachment type. To attach a file, use Allure::attachmentFile() method that accepts file name instead of string content.

Divide test methods into steps

Allure framework also supports very useful feature called steps. Consider a test method which has complex logic inside and several assertions. When an exception is thrown or one of assertions fails sometimes it's very difficult to determine which one caused the failure. Allure steps allow dividing test method logic into several isolated pieces having independent run statuses such as passed or failed. This allows to have much cleaner understanding of what really happens. In order to use steps simply use static shortcuts:

The entire test method execution status will depend on every step but information about steps status will be stored separately.


All versions of allure-phpunit with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0 || ~8.3.0
allure-framework/allure-php-commons Version ^2
phpunit/phpunit Version ^10
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 allure-framework/allure-phpunit contains the following files

Loading the files please wait ....