MageTestFest 2019 insights
This spring I attended Mage Test Fest – the only conference focused on ways and tools to improve the quality of Magento development. This year there were talks about frontend functional testing, as well as ways of improving code and processes. For people who needed deep knowledge in specific fields, there were workshops going for two days prior to the main conference. Also, everybody interested could participate in a contribution day to improve Magento quality tools.
The event was held in the Odeon movie theatre in the heart of Florence, Italy.
The first thing you could see upon arrival were posters with Magento-related parodies like “Mage Wars: The Adobe Conflict” in a style of “Star Wars”.
Then just before starting the event, there was a teaser trailer with fun videos about all of the posters you could see before.
Overview
The conference was very useful. The talk from Stephan Hochdörfer gave me a list of tools, which can help improve code quality, such as CaptainHook, PhpStan, DepTrac and composer security check packages. Another talk was about mutation testing – a way to guarantee that your unit tests are covering all edge cases. The Magento team explained how Magento Functional Testing Framework works and why everybody should use it; while Javier Villanueva shared his experience of using Cypress for end-to-end testing. Vinai Kopp told a story about property-based testing and how teams can benefit from it. Anton Kril talked about Magento architecture and which changes to expect.
A tool to try
Currently, we are having a test drive of CaptainHook – a tool from the first talk. It allows us to run various checks before commits. Our team uses it to automatically run all of the tests we have in continuous integration. This way we ensure that all of the code we push to repository will pass our checks.
Why CaptainHook:
- It makes it easier to manage all of the checks you want to do before commits such as static, unit or other types of testing.
- It’s easy to configure.
- It can use any bash command as a test.
- It has useful pre-build checks like PHPLint.
- It installs automatically for your entire team during
composer install
.
From all of the tools covered, I decided to try this one first because it’s very easy to setup and it saves a lot of time by giving a developer instant test results.
How to setup captain hook
Requirements are only Git and Composer.
To install use the following commandcomposer require --dev captainhook/plugin-composer
.
Then run vendor/bin/captainhook configure
.
You can configure checks that you need in captainhook.json
.
It should have a few pre-built checks by default. All of the available checks are in official documentation.
Add captainhook.json
and composer.json
to your repo, and everybody will have the same checks installed and activated automatically.
composer.lock
is checked to be up to date withcomposer.json
using pre-built\CaptainHook\App\Hook\Composer\Action\CheckLockFile
.- Php syntax errors are checked with
\CaptainHook\App\Hook\PHP\Action\Linting
. - PHPCS and PHPMD statically check php for
app/code
. - Stylelint checks styles in
app/design
. - PHPUnit tests are run for
app/code
andvendor/monsoon
.
Finito
I’m very glad that I went to this conference. I was very happy to meet all of these amazing people and learn useful insights. My experience with CaptainHook is great so far and I’m excited to try other tools as well. See you at the next Mage Test Fest.