2

I need to run some test that use a NTLM proxy. Due to Karate doesn´t support NTLM proxy, I think that if karate can "execute" a curl command like below, I will get kate working with NTLM:

curl -X GET 'https://someaddress.com/cats?Status=completed' -u siteuser:sitepasswd    --proxy-ntlm --proxy-user ckuser:ckpasswd --proxy internal-ntlm-proxy:8080 -s 

Anyone knows if I can call a curl command in Karate? (instead of the internal http request that Karate use when call Given... Path...)

Thanks

jsturnio
  • 103
  • 1
  • 7

1 Answers1

2

Yes, Karate has very good CLI support, if curl is present on your OS, it can be done. See this answer for details, available in 0.9.6 https://stackoverflow.com/a/62911366/143475

In your case, try first with karate.exec()

* def result = karate.exec("curl -X GET 'https://someaddress.com/cats?Status=completed' -u siteuser:sitepasswd    --proxy-ntlm --proxy-user ckuser:ckpasswd --proxy internal-ntlm-proxy:8080 -s")

And result will contain the console text. Note that there are regex helpers to make scraping values out easier, for e.g.:

* def token = karate.extract(result, 'some(pattern).+', 1)

For more tips on how to parameterize tests to be dynamic and use variables, refer: https://stackoverflow.com/a/64352676/143475

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • 1
    @jsturnio and thank you ! NTLM has been requested before a few times and `curl` never occured to me, so I've edited an old answer: https://stackoverflow.com/a/49878436/143475 - do report back once you get this to work ! – Peter Thomas Oct 14 '20 at 12:12