0

In JMeter Performance Testing tool I get the response in a compressed format so I need to uncompress the entire response using the zStd in the postprocessor.

I have download the jar file zstd-jni-1.5.5-5-win_x86 from the site https://repo1.maven.org/maven2/com/github/luben/zstd-jni/1.5.5-5/.

2 Answers2

0

You can import the zstd library to <Jmeter Installed directory>/libs

add a post processor -> select language as groovy

import com.github.luben.zstd.Zstd

// Get compressed response to variable
def compressedResp = prev.getResponseData();

// Decompress the response using library
def decompressedResp = Zstd.decompress(compressedResp); 
// Setting the decompressed response back 
prev.setResponseData(decompressedResp);

Refer code: https://www.tabnine.com/code/java/methods/com.github.luben.zstd.Zstd/decompress?snippet=5ce6b6407e03440004ee29aa

rollno748
  • 334
  • 2
  • 7
  • Thankyou for the response , I tried the above in the JSR223 Postprocessor selecting Language as Groovy but I am getting the below message java.lang.NoClassDefFoundError: Could not initialize class com.github.luben.zstd.Zstd at java.lang.Class.forName0(Native Method) ~[?:?] at java.lang.Class.forName(Class.java:398) ~[?:?] at org.codehaus.groovy.runtime.callsite.CallSiteArray.lambda$createCallStaticSite$2(CallSiteArray.java:65) ~[groovy-3.0.7.jar:3.0.7] at java.security.AccessController.doPrivileged(Native Method) ~[?:?] – Nivethitha SK Aug 30 '23 at 09:08
0

How about just calling Zstd.decompress() function?

def decompressedData = new String(com.github.luben.zstd.Zstd.decompress(prev.getResponseData(), prev.getResponseData().size()))

if you want you can store it into a JMeter Variable:

vars.put('decompressedData', decompressedData)

More information regarding what do these prev and vars mean: Top 8 JMeter Java Classes You Should Be Using with Groovy

When it comes to installing the library:

  1. Consider using win_amd64, I doubt that you use 32-bit operating system
  2. Drop it to JMeter Classpath
  3. Restart JMeter to pick up the .jar
Dmitri T
  • 159,985
  • 5
  • 83
  • 133