Task extension for Gatling to create custom launcher/integration for other system. Gatling pull request The purpose is to create task to run Gatling and get run result object after execution instead of execution status code. Furthermore that extension provides facilities to get requests statistics from simulation log file.
Creating a task from Gatling configuration parameters:
val gatlingOverrides: ConfigOverrides = ...
val task: GatlingTask = new GatlingTask(gatlingOverrides)
Creating a task from simulation class:
val task: GatlingTask = new GatlingTask(classOf[MySimulation])
Creating a task using task builder:
val someSimulationConfig: Config = ConfigFactory.parseString("{\"baseUrl\":\"localhost\",\"usersCount\":\"10\"}")
val task: GatlingTask = new GatlingTaskBuilder(classOf[MySimulation])
.resultsDirectory("custom_result_directory")
.simulationConfig(someSimulationConfig, "simulationConfig.json")
.build()
GatlingTask class implements Callable interface.
...
val result: GatlingRunResult = task.call()
By default simulation log file is generated automatically after each Gatling run.
...
val result: GatlingRunResult = task.call()
val logReader: RunResultFileReader = new RunResultFileReader(result.runResult, task.gatlingOverrides)
val startTime: Long = logReader.runStart()
val endTime: Long = logReader.runEnd()
val requestsStats: List[RequestStats] = logReader.computeRequestsStats()
val assertionsResults: List[AssertionResult] = logReader.assertionResults()