1

I'm trying to integrate Gatling into my project and I've got this example working, but again, I'd like to pull it into an existing project.

I'm attempting to create a new directory within my project structure to house the Gatling stuff, but any .scala file I put in there doesn't seem to find my packages upon import (see image: works and doesnt work areas)

works_doesntWork

I'm not seeing any errors in my Intellij build.sbt/plugins.sbt files, which is obvious if one of the .scala files is seeing the packages. I'm totally lost with this problem.

By "not seeing my packages" I mean, when I import io.gatling... works.scala finds the packages whereas doesntWork.scala doesn't seem to see anything (not just io.gatling)

Matt
  • 3,508
  • 6
  • 38
  • 66

1 Answers1

2

Your problem is more related to your overall build. Gatling expects your simulation classes to be in src/test/scala directory, but you can change its expectations. Just add the following setting into your build.sbt:

scalaSource in Gatling := file("qa")

This will solve your problem in sbt layer. You can prove it via running the `sbt ' in console and typing:

inspect gatling:scalaSource

or simply

galting:test

Another side of your problem is Intellij. I'm not sure if you have imported the whole project via Intellij sbt import or not. but I'm guessing that scala sbt plugin is not such a smart to recognize your specific changes to sources. You can prove this by reimporting the whole project or just clicking refresh in your SBT tool window:

SBT tool window

To open the tool window select View > Tool Windows > SBT from menu.

If it does not help (and I assume it won't) you can still add the qa directory into test directories. Just select File > Project Structure from menu. Select Modules in the left pane. Select your project in middle pane. Select Sources tab, your directory and click Tests in the Mark as row. Commit your changes with OK button. See picture bellow:

enter image description here

Now your Intellij should compile your simulations.

Btw: files in project directory are considered as separate module in IntelliJ, hence they compile. Same structure and point of view has also SBT, which considers everything under this directory to be separate module. That explains why your files there compile.

Enjoy

Teliatko
  • 1,521
  • 1
  • 14
  • 15