Commit ff58dda9 authored by Tom Käsler's avatar Tom Käsler

add basic auditor behaviour for stresstest

parent 8957c8d1
package de.thm.arsnova
import de.thm.arsnova.auditor.BasicAuditorSimulation
import io.gatling.core.Predef._ // 2
import io.gatling.http.Predef._
import scala.concurrent.duration._
......@@ -21,10 +23,11 @@ class Stresstest extends Simulation {
val uri1 = "http://localhost:9000/session/1"
val scn = scenario("BasicSimulation")
.exec(http("request_0")
.get("/session/1")
.headers(headers_0))
val auditorScn = scenario("Test").exec(
BasicAuditorSimulation.joinSession,
BasicAuditorSimulation.getAllPrepQuestions,
BasicAuditorSimulation.answerToMCQuestion
)
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
setUp(auditorScn.inject(atOnceUsers(1))).protocols(httpProtocol)
}
\ No newline at end of file
package de.thm.arsnova.auditor
import de.thm.arsnova.models.ChoiceAnswer
import io.gatling.core.Predef._ // 2
import io.gatling.http.Predef._
import scala.concurrent.duration._
import spray.json._
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
object BasicAuditorSimulation {
import de.thm.arsnova.mappings.ChoiceAnswerJsonProtocol._
val joinSession = exec(http("Auditor joins session")
.get("/session/1"))
val getAllPrepQuestions = exec(http("Auditor gets all preparation questions")
.get("/question/")
.queryParam("sessionid", "1")
.queryParam("variant", "preparation"))
val newAnswer = ChoiceAnswer(None, 5, 1, 2)
val answerToMCQuestion = exec(http("Auditor answers mc question")
.post("/question/5/choiceAnswer")
.header("Content-Type", "application/json")
.body(StringBody(newAnswer.toJson.toString)).asJSON)
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment