1

In most of the example in the feature file of karate as:

Background:
* url authURL
* path 'token'
* form field grant_type = 'password'
* form field username = 'username'
* form field password = 'password'
* form field client_id = 'appId'
* form field client_secret = 'appSecret'
* form field scope = 'your_App_Scope'

I wanted to write only GET/POST related tests in karate and define this client in Java code and just use that in GET/POST call in karate feature file. Is there any way to do this?

Note: I do not want to replace just URL rather I want to use the whole HTTP client which is defined in java code in karate test file.

Shashi Ranjan
  • 87
  • 1
  • 10
  • please be clear. just the target URL or HTTP client ? what do you mean ? – Peter Thomas Mar 10 '22 at 06:22
  • I want to use HTTP java client in karate feature file, not just url. – Shashi Ranjan Mar 10 '22 at 06:31
  • first let me say please assume that OFFICIALLY this is not supported by karate, so you are on your own, look for another tool if needed. that said these 2 links may help: https://github.com/karatelabs/karate/tree/master/karate-mock-servlet#switching-the-http-client | https://stackoverflow.com/a/56462226/143475 – Peter Thomas Mar 10 '22 at 06:54

0 Answers0