Custom Framework Listeners

In my past articles, I’ve written about using custom listeners as part of getting the desired reporting or making your tests do what you want. I’ve always referred offhandedly to these listeners, never paying them direct attention. I figured it was finally time to actually write a full-fledged post about listeners and some useful tricks.

What Is a Listener?

Most testing frameworks (JUnit, TestNG, Cucumber, Robot…) have what they call a ‘listener.’ This is a class with methods that runs before or after your tests and has hooks into reporting and logging. It works within the framework to identify what passes, what fails, and maybe even why. Sometimes, these also include how and when tests are executed. Understanding how these listeners work can add additional insight into how your tests run. Understanding how these listeners can be modified can allow you greater control over your tests.

Running Cucumber With Maven

A little while ago (ok, maybe in the distant past), I started writing about Cucumber. My very first post detailed how to set up Cucumber JVM, and we’ve come a long way from then. I thought it was worth revisiting, as there are simpler ways to get set up, and better tools out there to use. So with that, let’s dive back in!

Build Tools

Previously, I was setting up the project by manually identifying and downloading each of the required jars into a lib directory. That is so last decade to do things. What we should be doing is orchestrating and controlling these dependencies with a build tool.