0

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.

James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

0

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
Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks Dmitri for your response. I checked the document. I kept extentreports-5.0.9.jar inside Lib folder and used JSR223 Element. I used Java as the language. I am getting the below message "Error in method invocation: Method AttachReporter( com.aventstack.extentreports.reporter.ExtentSparkReporter ) not found in class'com.aventstack.extentreports.ExtentReports'". It is throwing at line "extent.AttachReporter(spark);" – KALISWARAN NACHIMUTHU Oct 04 '22 at 21:37
  • You're neither using the same library version nor the same code, what do you want from me exactly? – Dmitri T Oct 05 '22 at 07:29