0

Image Reference

In jmeter I am m testing a https client.The APIs get hit properly when using samplers.But when i try to call to make request using java methods from the imported jar file in jmeter (using JSR223 preprocessor in grrovy language),I m facing the following error.(refer 2nd Pic).In the publish model method,i make request to the same https client using java rest assured framework.

Groovy

Mani Maran
  • 21
  • 1
  • 9

1 Answers1

0

As per JMeter documentation:

The JMeter HTTP samplers are configured to accept all certificates, whether trusted or not, regardless of validity periods, etc. This is to allow the maximum flexibility in testing servers.

so if you cannot establish a HTTPS connection with your Groovy code it means that something is wrong with the certificate (for example domain mismatch or it expired) or with the certification chain (i.e. there are missing or untrusted certificates). JMeter's HTTP Request samplers ignore the SSL problems otherwise 8 of 10 testers would have the problem you described.

You can

  1. Obtain the problematic certificate (or its chain) from the server using your browser
  2. Use keytool utility to save it into the Java Truststore
  3. Set JMeter's javax.net.ssl.trustStore system property to point to the truststore from the step 2
  4. Set JMeter's javax.net.ssl.trustStorePassword to set the password for the truststore
  5. Your request should be successful now

More information:

Also it can be worked around on the code level, see i.e. Trusting all certificates using HttpClient over HTTPS thread

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