I run this test fine when I run each scenario by itself, but when combining them I do get a HTTP 415 error (body=
The server cannot service the request because the media type is unsupported.)
`
package no.me
import java.util.concurrent.atomic.AtomicInteger
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class MultipleSCNSimulation extends Simulation {
val httpProtocol = http
.baseURL("https://xxx")
.inferHtmlResources()
.acceptEncodingHeader("gzip,deflate")
.contentTypeHeader("text/xml;charset=UTF-8")
.userAgentHeader("Apache-HttpClient/4.1.1 (java 1.5)")
.disableUrlEncoding
val scn1 = scenario("papir")
.feed(csv("data/valuecodes.csv").random)
.exec{session =>
val md = java.security.MessageDigest.getInstance("SHA-1")
val str = "xxx" +
"1104" + "xxx" +
"2015-02-04 12:23:55" +
"xxx" +
session("valcode").as[String] +
"1" +
"xxx"
val ha = new sun.misc.BASE64Encoder().encode(md.digest(str.getBytes))
val macValuecode = ha.substring(0, ha.length() / 2 )
session.set("macValueCode", macValuecode)}
.exec(http("papir")
.post("https://xxx")
.headers(Map("SOAPAction" -> "http://xxx"))
.body(ELFileBody("bodies/xxx.txt"))
.check(status.is(200)))
val scn2 = scenario("digital")
.feed(csv("data/members_1500_1Percent_Random.csv").random)
//.feed(csv("data/members_1500_3Percent_Random.csv").random)
//.feed(csv("data/members_1500_5Percent_Random.csv").random)
//.feed(csv("data/members_1500_7Percent_Random.csv").random)
//.feed(csv("data/members_1500_12Percent_Random.csv").random)
.exec{session =>
val md = java.security.MessageDigest.getInstance("SHA-1")
val str = "xxx" +
"1104" +
"xxx" +
"2015-02-04 12:23:55" +
"xxx" +
session("medlem").as[String] +
"2" +
"xxx"
val ha = new sun.misc.BASE64Encoder().encode(md.digest(str.getBytes))
val macMemberId = ha.substring(0, ha.length() / 2 )
session.set("macMemberId", macMemberId)}
.exec(http("digital")
.post("https://xxx")
.headers(Map("SOAPAction" -> "http://xxx"))
.body(ELFileBody("bodies/xxx_request.txt"))
.check(status.is(200)))
setUp(scn1.inject(atOnceUsers(2)), scn2.inject(atOnceUsers(2)).protocols(httpProtocol))
//setUp(scn1.inject(constantUsersPerSec(1) during (5 seconds))).protocols(httpProtocol)
//setUp(scn2.inject(constantUsersPerSec(1) during (5 seconds))).protocols(httpProtocol)
}
`
Why do I get a media type error when running two scenarios in parallelland not when i run them separately ?