Allure Report's support for PHP testing automation frameworks has existed for years, starting with the early Allure 1 versions. In time, integrations become obsolete, and whilst the Allure-PHP set of integrations kept working, they lacked the support of numerous advanced features both from the Allure and PHP automation frameworks.
We want to thank our OSS community folks and in particular Edward Surov, Head of QA at TheSoul Publishing, for your help in fully refactoring and updating the PHP integrations.
In this post, we will take a closer look at the changes and why you should update as soon as possible.
Allure PHP Commons Update
Allure’s new PHP Commons is a repository containing PHP APIs for the Allure framework. It provides a reusable API for creating adapters for different test frameworks. The new release, being a deeply refactored API bridge for PHP automation tools, adopts all the Java Commons implementation features and adds some additional neat functions too.
While Allure 2 has backward compatibility with Allure 1, the process of developing new Allure adapters has been massively improved in this recent version. Our team managed to keep a high pace in Commons development for Java, Javascript, or Python, leaving the PHP Commons an actual technical debt.
What’s new
The Commons 2 release aligns the PHP tooling with Allure 2 features such as test result generation, steps, attachments, etc. It also gives much more flexibility in making PHP testing automation tools integrations.
Allure lifecycle support
The PHP Commons update provides a modern Allure lifecycle implementation. Long story short, the new approach relies on real-time access to testing objects such as test case, step, attach, etc. instead of passive events waiting.
Another neat PHP implementation-specific feature is that any object can be excluded from a report. Why would you need that? For example, to save some storage space by on-the-fly deleting screenshots for successful tests.
PHP 8.0
With the transition to PHP 8.0 native attributes come instead of the legacy docblock annotations. Native attributes make creating custom annotations much easier. Now, it's enough just to implement the necessary interfaces.
Other improvements
Updated model providers, obsolete entities deprecation, etc. All these internal updates are great news for PHP Allure users. The full list of improvements and features is available at the GitHub pull request.
Frameworks support and compatibility
By now, the PHPUnit adaptor is up-to-date and already used in production. We are working on moving Codeception (soon!) and Behave (a bit later) to Commons 2 standards.
Anyway, support for ‘traditional’ docblock annotations has been saved as a legacy, so older tests will work with a new version of Commons without any issues. That means there is no need to rush and update the codebase ASAP. Just update tests at your own pace.
Join Open Source Community!
As mentioned above, this update was completely community-driven. We would like to specifically express our appreciation to Edward Surov for all of his hard work. Let us take this opportunity to remind you that the OSS community is about sharing. Qameta Software runs an OpenCollective project to support major open-source contributors! Join in!
.For each Allure Report user, there are several ways to contribute to the project:
- Expertise: Join our GitHub Discussions community to help others with advice;
- Code: Contribute to Allure Framework by creating an example or fixing an issue;
- Time: Propose some fixes or updates to our docs, they are open-sourced either!
- Funds: If you are tight on time, donate a buck and we’ll be happy to share it with community developers!
… or just drop Allure2 repo a GitHub star!