API testing using http protocol, not working

Gatling seems to be a promising tool with easy scripting steps.

I had to perform load testing on an api, which I was able to achieve in JMeter with HTTP REQUEST, & protocol was https & method POST.

The sample url is https://somedomain.com/page1/ID, where the ID should be sent from a csv file dynamically.

I created the same scenario using Gatling1.5.2 & ran the test.The url is correctly passed , but it is throwing error Home page: KO Check ‘in’ failed, found 404 but expected Range(200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210). I read in one of the threads in Gatling Google group that api testing is not supported in lower versions of Gatling. Is it because of that?

Thanks,
Harine

I don’t know where you read the sentence “api testing is not supported”, but it wasn’t referring to web API but probably to java API (doing some Java benchmarking, like you usually do with tools such as Caliper).

What you’re trying to do with Gatling is very easy actually.
Could you share your simulation, please?

Hi Stephane,
I am sorry if I misunderstood the thread.Find my simulation.

package packagename

import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.jdbc.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import akka.util.duration._
import bootstrap._

class LoadTest1 extends Simulation {

val httpConf = httpConfig
.baseURL(“https://somedomain.com”)
.disableCaching

val headers_1 = Map(
“Accept” → “text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, /; q=0.01”,
“Connection” → “keep-alive”)

val scn = scenario(“Scenario name”)
.feed(csv(“User.csv”))
.exec(
http(“Home page”)
.post("/page1/page2/${User}")
.basicAuth(“abcdefgh”, “abcdefgh”)
.headers(headers_1))

setUp(scn.users(10).ramp(1).protocolConfig(httpConf))

}

You have a POST, yet you don’t post anything (no params, no body).
Are you sure you’re not missing something here?

I tried sending the ${User} as a aparam also, It didnt work.Actually if you have a name to the parameter only you can send as a param no? Like for example:
param(“user”:"${User}")
I do not know what is the name for the parameter, in Jmeter I sent it in Raw Data.
I tried sending the data in body also,
.body("""{ “user”: “${User}” }"""), even this didnt work.

Stephane,

I was just informed that the url was changed because the application went to production & the testing setup was removed. I was on leave for couple of days. Extremely sorry to post the question.

No pro, and pity you couldn’t go further with Gatling. Maybe next time :wink: