1

I didn't add a comment in this Debug Scala Post because in my opinion it was another setup.

I had a similiar problem with Maven instead of SBT. I used Maven because the complete Java project was built upon it and I only wanted to debug my Gatling Scala code. However I'm not able to debug the code with the IDE.

Here's what I tried:

  • Clean the built mvn clean install
  • Invalidate caches in IDEA with the menu button
  • Use println to see whether the code is reached - worked
  • Redeploy the project on the Glassfish
  • Delete the generated files in the Glassfish and redeploy

This is my current setup:

My solution is as follows.

Dr4gon
  • 421
  • 8
  • 17

2 Answers2

1

With the help of colleague I figured out that the main class in Engine from the Gatling tutorial can be used to debug out of Intellij.

I basically built the whole archetype and moved the following files into the corresponding folders:

  • src/test/resources/gatling.conf
  • src/test/scala/Engine.scala and IDEPathHelper

That did the trick for me.

Dr4gon
  • 421
  • 8
  • 17
  • How do run the tests to be able to debug them? I'm running the main func from Engine class but it stops on `com.my.package.MySimulation is the only simulation, executing it. Select run description (optional)` – Frankie Drake Sep 09 '22 at 09:17
1

If anybody is finding hard to this just create a logback.xml file under src/test/resources and mention the following according to your need:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
            <immediateFlush>false</immediateFlush>
        </encoder>
    </appender>
    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
        <file>../gatling.log</file>
        <append>true</append>
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
        </encoder>
    </appender>
    <!-- Uncomment for logging ALL HTTP request and responses -->
    <!--  <logger name="io.gatling.http.ahc" level="TRACE" /> -->
    <!--   <logger name="io.gatling.http.response" level="TRACE" /> -->
    <!-- Uncomment for logging ONLY FAILED HTTP request and responses -->
    <logger name="io.gatling.http.ahc" level="DEBUG" />
    <logger name="io.gatling.http.response" level="DEBUG" />
    <root level="WARN">
        <appender-ref ref="CONSOLE" />
    </root>
    <root level="WARN">
        <appender-ref ref="FILE" />
    </root>
</configuration>