skamsie
skamsie

Reputation: 2726

Cannot run Scala file in Intellij

I have set up a gatling project in Intellij IDEA 14.4 community edition. I have the Scala plugin installed and the project configuration seems to be correct (since I do not see and inline errors and compile works fine). However I have red in some tutorials that you can also run the current file by right clicking on it and choosing run or debug. I do not see these options and I cannot figure why:

enter image description here

I have tried Invalidate Caches / Restart but that did not work either...

EDIT:

I should have mentioned I have no experience with scala. What I am trying to do is actually run individual gatling simulations from Intellij because it is more convenient and I can also debug them. Most of the code I have is based on examples but in reality I have no idea what I am doing. So to reformulate, let's say I have the following simulation file PingSimulation.scala. Where should I add the main() function to be able to run the file individually in Intellij?

package atlas

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

class PingSimulation extends Simulation {
  object Ping {
    val ping = exec(http("Ping")
      .get("/ping")
    )
  }

  val httpConf = http.baseURL(Endpoints.testing_url)

  val scn = scenario("Ping").exec(Ping.ping)

  setUp(
    scn.inject(atOnceUsers(1)).protocols(httpConf)
  )
}

Upvotes: 4

Views: 2577

Answers (1)

Arne Claassen
Arne Claassen

Reputation: 14394

From your screenshot there doesn't seem to be anything to run in scope. You need to have either an object that extends App or provides a def main. A class itself cannot be run.

Upvotes: 3

Related Questions