1

I am getting an error as below when I execute my scenario

Feature: sample karate test script for ws+

Background:

Scenario: get all users and then get the first user by id

Given path 'sakmaler'

  • When method get
  • Then status 200

When method gets executed, I get the below exception.

com.intuit.karate.exception.KarateException:

com.intuit.karate.exception.KarateException: wsplussnav.feature:14 -

java.net.UnknownHostException: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server (pluss-nav2.ekstern.acos)

Note: I get this exception only when I execute test on this url. This url does not have any proper domain like .net or .com

I tested in postman, and it works.

I tested in powershell command, and it works.

Any idea how to re-solve this error in Karate?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Senthil
  • 11
  • 2

1 Answers1

0

Most likely you are behind a corporate proxy, which is why it works in P*stman.

Refer the docs: https://github.com/intuit/karate#configure

karate.configure('proxy','http://myhost:80');

EDIT: for others landing here, besides the fact that an HTTP proxy may be in the picture - another place where Karate behaves a bit differently than Postman is that Karate does not auto-send an Accept header by default.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Thank you for the swift response. I spoke with IT, and we do not have any proxy setting. I am executing the test inside our corporate network. – Senthil Feb 04 '20 at 11:08
  • @Senthil you have some DNS issue. see this: https://stackoverflow.com/a/49644598/143475 - if you can replicate this on a public host (highly unlikely :) we will look at the issue: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Feb 04 '20 at 11:18
  • I have changed the headers to * url 'https://pluss-nav2.ekstern.acos/api/api/register/' * configure headers = { Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' } * configure ssl = { trustAll: true }; * header Authorization = 'Bearer token' After changing this, It throws different exception com.intuit.karate.exception.KarateException: wspluss.feature:14 - java.net.SocketException: Connection reset – Senthil Feb 04 '20 at 21:11
  • Also, I tried the solution mentioned in https://stackoverflow.com/questions/49198787/karate-connection-reset-error-when-connecting-to-internal-qa-server-dev-server but it did not help – Senthil Feb 04 '20 at 21:21