Commit 4f18306b authored by Tom Käsler's avatar Tom Käsler

add "MC Question create" request to a basic tutor simulation

parent d1fa6251
Pipeline #7908 passed with stages
in 2 minutes and 54 seconds
......@@ -31,7 +31,8 @@ class Stresstest extends Simulation {
)
val tutorScn = scenario("Basic Tutor").exec(
BasicTutorSimulation.createSession
BasicTutorSimulation.createSession.pause(3),
BasicTutorSimulation.createQuestion
)
setUp(
......
package de.thm.arsnova.tutor
import de.thm.arsnova.models.Session
import de.thm.arsnova.models.{AnswerOption, Question, Session}
import io.gatling.core.Predef._ // 2
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
import spray.json._
......@@ -10,13 +10,29 @@ import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import java.util.Calendar
object BasicTutorSimulation {
import de.thm.arsnova.mappings.QuestionJsonProtocol._
import de.thm.arsnova.mappings.SessionJsonProtocol._
val now = Calendar.getInstance.getTime.toString
val newSession = Session(None, "12312312", 1, "A new Session", "ans", now, now, true, false, false, None)
val mcAnswerOptions = Seq(
AnswerOption(None, None, false, "12", -10),
AnswerOption(None, None, true, "13", 10),
AnswerOption(None, None, false, "14", -10),
AnswerOption(None, None, true, "thirteen", 10)
)
val newMCQuestion = Question(None, 1, "new Question Subject", "This is an MC question for stress testing",
"preparation", "mc", Some("This is the hint!"), Some("The answer is 13"), true, false, true, true, false, None, Some(mcAnswerOptions))
val createSession = exec(http("Tutor creates session")
.post("/session/")
.header("Content-Type", "application/json")
.body(StringBody(newSession.toJson.toString)).asJSON)
val createQuestion = exec(http("Tutor creates mc question")
.post("/question/")
.header("Content-Type", "application/json")
.body(StringBody(newMCQuestion.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