How to decompress the compressed response In Jmeter Performance Testing tool

110 views Asked by At

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

There are 2 answers

1
rollno748 On

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

0
Dmitri T On

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