1

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 ?

Sneha Shukla
  • 373
  • 1
  • 4
  • 19

1 Answers1

3

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) }
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • It's a requirement. I can't skip negative tests. The only problem is this response does not give any response code for failure which is blocking me. Thanks Anyways . I will try it with a second feature. – Sneha Shukla Mar 11 '19 at 05:09
  • @SnehaShukla whatever you say. personally I think it is a stupid requirement :) – Peter Thomas Mar 11 '19 at 05:10
  • @PeterThomas: Although, this is stupid, I tried this and I am able to make by test pass by simple js call in feature. But exception is generic karate exception, is there a way to get the actual exception being thrown?? – shrik18 Dec 12 '22 at 13:55
  • @shrik18 I am not sure. you are welcome to dig into the code and contribute more if needed – Peter Thomas Dec 12 '22 at 14:09
  • I will raise an issue and do that. – shrik18 Dec 13 '22 at 12:46