Kamil Kokot15/09/2015

Easy debugging on CI with Mink

Debugging Behat scenarios while using Mink to simulate the user is not always an easy job. Especially, if they are run on Continuous Integration server. That is why I came up with an idea to make it easier.

During repairing our javascript test suite on Sylius everything went as bad as it could go. There were many errors that happened on Travis, but I was not able to reproduce them locally. Lack of assets, issues with handling modal windows, random Chrome crashes are just a few of them. The worst thing was that I did not have any logs available and Travis 4MB output limit was too small for my needs.

MinkDebugExtension was written to speed up that boring and tiring part of debugging on CI server. It consists of two parts: Behat extension and useful scripts.

Behat extension

It is activated after every failed step. Creates logs containing current URL, status code, request headers and body and response contents. It also takes screenshots of your page in browser if using Selenium2Driver. Its installation and configuration takes less than a minute (have a look at documentation).

Useful scripts

Okay, so you have nice logs and screenshots created by that extension, but how are you going to browse through them? It could not be easier! The extension comes bundled with three scripts, two of them are for uploading files on remote server.

  • travis/tools/upload-textfiles can upload your logs to termbin.com - awesome service, which allows you to paste files through netcat!
  • travis/tools/upload-screenshots that provides an easy way to upload generated screenshots to imgur.com - the only thing you need is their API key.

There is also one script that is waiting until the port is taken - travis/tools/wait-for-port - and they are all documented.

How to get started?

The whole extension is documented at its main page. Take a look at PR #3055 at Sylius for integration with an existing application.


Want to see how we work?

This website uses cookies to improve your experience. We’ll assume you are ok with this, but you can opt-out if you wish, and read more about it or just close it.