Is possible to execute curl in Karate tests?

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)

Leave a Comment