Reputation: 5031
we have some load tests in gatling (written in Scala), we can run the test from command but cannot run/debug it in IntelliJ. in the IntelliJ, i don't see there is no green button(arrow) next to that class that I can click and run it; right click that class in the popup menu there is no option as 'run ClassName' or 'debug ClassName'. I'm wondering if we define the class wrong. here is the test class:
class IngestionTestExecution
extends IngestionScenarios
with TestScenariosExecution { ... }
trait IngestionScenarios extends CommonScenarios with RequestBuilders {..}
trait TestScenariosExecution extends Simulation with StrictLogging {...}
the commandline to run the test:
sbt "project qaLoad" "gatling-it:testOnly com.example.load.gatling.execution.IngestionTestExecution"
is that true that i have to have my test class IngestionTestExecution
directly extends Simulation
in order to run/debug in IntelliJ?
Upvotes: 0
Views: 2890
Reputation: 1773
It could be that it's a gradle project, check if you have a build.gradle file with a gatling section.
run it with this command:
gradle gatlingRun
https://docs.gatling.io/reference/integrations/build-tools/gradle-plugin/
Upvotes: 0
Reputation: 481
To run a Gatling project from IntelliJ, you need to download the Scala plugin for IntelliJ and you need to have an entry point to the project, namely a main
method.
For example:
package com.example.project
object ApplicationRunner {
def main(args: Array[String]): Unit = {
val simClass: String = com.example.project.simulations.mySimulationClassName
val props = new GatlingPropertiesBuilder().
simulationClass(simClass)
Gatling.fromMap(props.build)
}
}
The little green button will appear next to this object and next to the method as well. You can also create a run config from scratch (via Run > Edit configurations), which points to this object as a main class.
I think your inheritance structure is fine, especially if sbt
runs the tests.
Upvotes: 2