4

I have an existing Gatling project with Scala that I'm executing using the command line (no IDE currently). I have a need to be able to reference another external project so I am attempting to use SBT along with it, but I cannot seem to get this working.

I've referenced the following page: https://gatling.io/docs/current/extensions/sbt_plugin/ and the only real difference I've tried to make is a different directory, which appears to be correct.

I get the following error whenever I compile or run gatling:test

object gatling is not a member of package io
[error] import io.gatling.core.Predef._
[error]           ^

The issue looks to be that SBT is not picking up the Gatling project correctly. My files currently looks like this:

build.sbt

enablePlugins(GatlingPlugin)

scalaVersion := "2.12.8"

scalacOptions := Seq(
  "-encoding", "UTF-8", "-target:jvm-1.8", "-deprecation",
  "-feature", "-unchecked", "-language:implicitConversions", "-language:postfixOps")

scalaSource in Compile := baseDirectory.value / "Gatling"

libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "3.1.3" % "test"
libraryDependencies += "io.gatling"            % "gatling-test-framework"    % "3.1.3" % "test"

plugins.sbt

addSbtPlugin("io.gatling" % "gatling-sbt" % "3.0.0")

build.properties

sbt.version=1.2.8

If you are wondering why the plugins file reference version 3.0.0 while build references 3.1.3 it's because of the version that exists on Bintray https://bintray.com/gatling/sbt-plugins/gatling-sbt/view

Any help on diagnosing this issue would be much appreciated.

Serberuss
  • 2,247
  • 4
  • 22
  • 40

2 Answers2

4

All that you configuration, follow @Mateusz Kubuszok answer. you should move your .scala class(es) (that extends Simulation) to src/test/scala like

src/test/scala/FirstTest.scala

if it's has package like com.example then it should be

src/test/scala/com/example/FirstTest.scala

0

After keeping scala script inside the package also same issue is there, src/test/scala/com/example/FirstTest.scala

  • 1
    This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/32600935) – user-id-14900042 Sep 03 '22 at 08:07
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Vikram Parimi Sep 07 '22 at 12:16