Sneha Shukla
Sneha Shukla

Reputation: 383

How to handle SSL certificate handshake failure error using karate dsl?

I am validating my SSL algorithm by setting the configure ssl = 'TLSv1.2' which gives me 200 response code.

But , if the algirithm is not TLSv1.2, it just throws a raw error with no response code like this :

14:53:26.025 javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake, http call failed after 22 milliseconds for URL: https://XXXX.com.au/event/countryTLSV11/v1/countries 14:53:26.026 http request failed: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake

Is there any way to handle this error ?

Upvotes: 1

Views: 809

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

Personally I think you are wasting time on a negative test that will not give you much benefit. Positive tests should be good enough.

But if you insist, use a second feature to do the HTTP request. Then you can handle the error in JavaScript:

* eval try { karate.call('my.feature') } catch(e) { karate.log('failed:', e) }

Upvotes: 3

Related Questions