'Unable to load a Suite class' while running ScalaTest in IntelliJ

后端 未结 12 1042
有刺的猬
有刺的猬 2021-01-01 10:07

I\'m having some issues today with running a simple TestKit test in Intellij. The tests are for Scala code (I have the Scala plug-in for Intellij) and are based on Ray Roes

相关标签:
12条回答
  • Simply running build project worked for me.

    0 讨论(0)
  • 2021-01-01 10:40

    I met this issue when I used Gatling

    I fix it by replacing gatling-classes to test-classes on File -> Project Structure -> Modules -> Module Name -> Paths -> Test output path

    0 讨论(0)
  • 2021-01-01 10:40

    This issue happened to me recently when I was trying to run tests in an inherited Scala project using IntelliJ IDEA 2018 (Community Edition). Below steps helped me to fix it:

    1. File → Project Structure → {Choose specific module} → "Paths" tab → Select "Use module compile output path" → Modify "Test output path" to point to test-classes folder. For example:

      Output path: /home/rustam/IdeaProjects/{project}/{module}/target/scala-2.12/classes
      Test output path: /home/rustam/IdeaProjects/{project}/{module}/target/scala-2.12/test-classes

    2. IntelliJ does not like multiple Scala classes defined in one file, so make sure the test class is named the same as the test file and nest other helper classes, which you can refactor later as necessary.
    0 讨论(0)
  • 2021-01-01 10:40

    In my case I had in Preferences -> Build, Execution, Deployment -> sbt

    Use sbt shell for build and import checkbox enabled

    And the test was not in the expected directory src/test but in src/it (integrated test).

    0 讨论(0)
  • 2021-01-01 10:44

    Run build the project - It helped me to resolve that issue that could have happened to me when I cleared Cache IDEA :) while trying to tackle another issue

    0 讨论(0)
  • 2021-01-01 10:48

    I encountered the error when the test class was not part of any package.

    0 讨论(0)
提交回复
热议问题