Creating Cucumber Extent Report the Right way.

Praveen David Mathew
4 min readMay 11, 2020

The right way is to use custom formatter (Plugins)

So what does this means ?

We are going to create our own report plugin using Extent report.

As in TestNG reporting, where we override the TestNG listeners to tell TestNG what to do for each action or events,

Here, we implements Cucumber listener class to listen to cucumber events and tell it what to do for each event.

Cucumber sends events for each action like scenario started, step started, step finished etc to this instance of the listener. So here we handle these events and tell cucumber what to do with these events (In our case we will tell it to log it to extent report).

There are two listener interfaces:

  1. EventListener
  2. ConcurrentEventListener

So as the name suggests, concurrentEventListener is thread-safe and the other is not. The implementation is exactly the same so we will use only the concurrentEventListner so that our framework is threadsafe when we have to run things in parallel.

Our TestListener :

package cucumberHooks;import com.aventstack.extentreports.ExtentReports;import…

--

--

Praveen David Mathew

An open source advocator/WebdriverIO Projectcommiter/Postman Supernova/Postman-html-extra contributor/Stack overflow sqa moderator/Speaker