Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 调试会话_Scala_Performance Testing_Gatling - Fatal编程技术网

Scala 调试会话

Scala 调试会话,scala,performance-testing,gatling,Scala,Performance Testing,Gatling,作为性能测试的一部分,我需要调试会话等。如果我删除session=>,相同的代码正在运行。当我补充说,它说在模拟期间没有发送任何请求,因为它没有发送任何请求 val scn1 = scenario("LaunchAction").exec{ session => http("Poll report status page report") .get("myURL/rest/reports") .queryParam("applicationId", "123

作为性能测试的一部分,我需要调试会话等。如果我删除
session=>
,相同的代码正在运行。当我补充说,它说在模拟期间没有发送任何请求,因为它没有发送任何请求

 val scn1 = scenario("LaunchAction").exec{ session => 

   http("Poll report status page report")
     .get("myURL/rest/reports")
     .queryParam("applicationId", "123")          
     .queryParam("id", "1")
     .check(xpath("//status").saveAs("responseStatus"))

   session
}

我需要添加一些打印等之间。您能提供一些信息吗?

您可以向其中添加另一个exec,如下所示:

.exec(
      session => {
        val activityId = session.get("someId").asOption[String]
        println(activityId)
        session
      }
    )

这将为您提供会话详细信息。

我刚开始学习Gatling,我遇到了完全相同的问题。 对我来说,最简单的调试方法是添加entrypoint对象,我使用它通过运行main方法在本地启动/调试测试

object DebugEntrypoint {

  def main(args: Array[String]) {

    // This sets the class for the Simulation we want to run.
    val simClass = classOf[Smoke].getName

    val props = new GatlingPropertiesBuilder
    props.sourcesDirectory("./src/test/scala")
    props.binariesDirectory("./target/scala-2.10/classes")
    props.simulationClass(simClass)
    Gatling.fromMap(props.build)
  }
}

从这里执行测试后,我在模拟中设置的任何断点都将在运行时暂停执行。一旦遇到断点,您就可以对表达式求值,并让所有其他调试工具按您的要求进行调试。

您还可以在Gatling的conf文件夹中为调试做一件事 将有一个文件logback.xml,您必须在其中取消对这两行的注释

在取消这些行的注释后,您将在浏览器中详细运行时收到每个请求,这将帮助您解决查询

谢谢!我找了一会儿这个。它起作用了。致以最良好的祝愿。虽然我发现我们不能在exec区内这样做。。但打印更多信息的另一种方法是在logback.xml中将记录器级别更改为DEBUG