1

I recorded a Mobile Native application (HTTPS/JSON) using Jmeter.

The requests and responses captured as in JSON format and I am not able to view the values that are passed in the requests because they are encoded in base64.

How do I proceed?

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
Prattu
  • 45
  • 6
  • dupe of http://stackoverflow.com/questions/20952165/how-to-decode-base-64-format-in-jmeter? – Mardoz Aug 15 '14 at 13:03

1 Answers1

1

You can decode Base64 on the fly via Beanshell PostProcessor.

  1. Add Beanshell Post Processor as a child of the request you want to decode
  2. Put the following code into Beanshell Post Processor's "Script" area

    import org.apache.commons.codec.binary.Base64;
    prev.setResponseData(Base64.decodeBase64(data));
    
  3. View decoded response via View Results Tree Listener

Explanation:

  • Base64.decodeBase64() - self explanatory, it's the method of a class from Commons Codec package which provides Base64 encoding and decoding operations
  • prev is a shorthand for SampleResult class instance holding result of the parent sampler
  • data is the byte array representing parent sampler response data.

See How to use BeanShell: JMeter's favorite built-in component guide for more details on what can be done via Beanshell scripting.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133