MageTestFest 2019 insights

Vladimir Fishchenko

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.

MageTestFest2019 (8)

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”.

MageTestFest2019 (46)

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.

MageTestFest2019 (11)

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 command
composer 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.

Our configuration:

  1. composer.lock is checked to be up to date with composer.json using pre-built \CaptainHook\App\Hook\Composer\Action\CheckLockFile.
  2. Php syntax errors are checked with \CaptainHook\App\Hook\PHP\Action\Linting.
  3. PHPCS and PHPMD statically check php for app/code.
  4. Stylelint checks styles in app/design.
  5. PHPUnit tests are run for app/code and vendor/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.

 

MageTestFest2019 (239)

Vladimir Fishchenko Profile Picture

Vladimir Fishchenko,

Senior Magento Developer