Gatling + SBT + ScalaTest + IntelliJ - trouble invoking ScalaTests from IntelliJ

I built an SBT project to manage building and running my Gatling code.

I included ScalaTest so I could write unit tests for the reusable pieces of my Gatling code.

From the command-line, the unit tests work fine. But when I try to run them from IntelliJ, I get an error:

Unable to load a Suite class. This could be due to an error in your runpath. Missing class:

I found this: which includes a solution provided by someone who found the same problem when working with Gatling, which involved changing the Test output path configuration. Which lead to another problem:, which has a solution, but that solution is overridden whenever IntelliJ re-imports my build.sbt file.

Has anybody else encountered this problem and successfully resolved it permanently?

I can not help with your question, but maybe you could help me out.

Can you maybe post some of your code you use in the scalatest classes? I actually have some trouble to test my configuration.

I divide my tests into two parts. One part tests logic, support functions, etc. It gets tested via ScalaTest, like so:

class testUrlConstruction extends FreeSpec with Matchers {

“base url” in {
MyConfig.test_environment( “test/auth/base-url-only” )
val o = /* build an object that uses config to build the url /
o.url should be ( Success(/
expected url */) )


Then, in order to test bits of Gatling DSL, I make use of a base class I created:

trait UnitTest extends Simulation {
def behavior : ScenarioBuilder

setUp( behavior.inject( atOnceUsers(1) ) )
.protocols( Default.httpConfig ) // pulled from my support code
if ( Test.usePauses ) exponentialPauses . // Test.usePauses is part of my support code
else disabledPauses

When I have a bit of logic I want to test, I build a unit test, e.g.:

class testLogin extends UnitTest {
def behavior =
scenario( “Test that user can log in” )
.exec( _.set( “username”, “test-user” )
.exec( _.set( “password”, “password” )
.exec( myLoginChain )

All of these go in src/test, and I run the Gatling unit tests using sbt “gatling:testOnly testClass”, and I run ScalaTests via sbt “testOnly testClass”

My original query was, why do I have to run my ScalaTest tests from the command-line, I should be able to run them from the IDE, but it’s broken, and I’d really like to know why.

A related question would be, what would it take to add the ability to right-click on a simulation (or class that extends Simulation) and trigger gatling to run that class?