Hi All,
I am trying to create a framework for my performance test. I am able to run the POST/PUT api successfully by reading the body from a JSON file.
I also want to read the HTTP protocol configuration from JSON file instead of hardcoding it in the scala file. I am not able to do the same.
Has anyone tried to do this? please share your experience.
Example:
val httpProtocol = http
.baseUrl(“https://example.com”)
.acceptHeader(“application/json; v=1.5”)
.authorizationHeader(“bearer bearer token here”)
I want the above protocol properties to be read from JSON file instead of hard coding here.
I am reading JSON file in my POST/PUT calls using below code
def postCase1api()={
exec(
http(“post case”)
.post("/api/case1")
.body(ElFileBody(“resources/data/apicase.json”)).asJson
)
}