Jmeter - Functional Extent Report

138 views Asked by At

I would like to use Extent Report in Jmeter for functional testing. Please suggest some sample script and language, library to do this. I explored our page and unable to get the lib and steps to implement them.

I followed the Using extentreports for jmeter test results However, I am getting error message

Typed variable declaration : Class: ExtentReports not found in namespace

I am using extentreports-3.1.2.jar and kept inside the Jmeter Lib folder. Also I have imported them in the script as well.

1

There are 1 answers

2
Dmitri T On

Have you tried to look at Extents reports documentation? It seems to be comprehensive enough.

I don't know what you mean by "use Extent Report in Jmeter for functional testing", but given you're asking for a sampler code here is a minimal snippet suitable for using in any JSR223 Test Element assuming Groovy as the language:

import com.aventstack.extentreports.ExtentReports
import com.aventstack.extentreports.Status
import com.aventstack.extentreports.reporter.ExtentSparkReporter
import com.aventstack.extentreports.reporter.configuration.ViewStyle

def extentReports = new ExtentReports()
def reporter = new ExtentSparkReporter("report", ViewStyle.SPA)

extentReports.attachReporter(reporter)

def firstTest = extentReports.createTest("SomeTest")
firstTest.log(Status.PASS, 'Everything ok')

extentReports.flush()

You will need to:

  1. Have extentreports-4.1.7.jar in JMeter Classpath (as well as all it's dependencies if you will be using MongoDB as the reporting backend)
  2. Restart JMeter to pick the .jar up