Intellij idea 无法在IntelliJ中运行gatling测试
我们在gatling中有一些负载测试(用Scala编写),我们可以从命令运行测试,但不能在IntelliJ中运行/调试它。在IntelliJ中,我看不到该类旁边没有绿色按钮(箭头),我可以单击并运行它;右键单击弹出菜单中的该类,没有“运行类名”或“调试类名”选项。我想知道我们是不是把这个类定义错了。以下是测试类:Intellij idea 无法在IntelliJ中运行gatling测试,intellij-idea,gatling,scala-gatling,Intellij Idea,Gatling,Scala Gatling,我们在gatling中有一些负载测试(用Scala编写),我们可以从命令运行测试,但不能在IntelliJ中运行/调试它。在IntelliJ中,我看不到该类旁边没有绿色按钮(箭头),我可以单击并运行它;右键单击弹出菜单中的该类,没有“运行类名”或“调试类名”选项。我想知道我们是不是把这个类定义错了。以下是测试类: class IngestionTestExecution extends IngestionScenarios with TestScenariosExecution
class IngestionTestExecution
extends IngestionScenarios
with TestScenariosExecution { ... }
trait IngestionScenarios extends CommonScenarios with RequestBuilders {..}
trait TestScenariosExecution extends Simulation with StrictLogging {...}
运行测试的命令行:
sbt "project qaLoad" "gatling-it:testOnly com.example.load.gatling.execution.IngestionTestExecution"
为了在IntelliJ中运行/调试,我必须让我的测试类
IngestionTestExecution
直接扩展Simulation
,这是真的吗 要从IntelliJ运行Gatling项目,您需要下载for IntelliJ,并且需要有项目的入口点,即main
方法
例如:
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)
}
}
小绿色按钮将显示在此对象旁边以及方法旁边。您还可以从头开始创建一个运行配置(通过运行>编辑配置),该配置将此对象作为一个主类指向
我认为您的继承结构很好,特别是如果sbt
运行测试。请在中报告,并附上。