Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not found: type Simulationbloop #2519

Open
RajatVardam opened this issue Nov 28, 2024 · 1 comment
Open

not found: type Simulationbloop #2519

RajatVardam opened this issue Nov 28, 2024 · 1 comment

Comments

@RajatVardam
Copy link

RajatVardam commented Nov 28, 2024

I am simply running one of the examples from gatling website. Full eample link: https://github.com/gatling/gatling-maven-plugin-demo-scala. Code with problem is as follows:

package computerdatabase

import io.gatling.core.Predef._
import io.gatling.http.Predef._

import java.util.concurrent.ThreadLocalRandom

/**

  • This sample is based on our official tutorials:
    • [[https://docs.gatling.io/tutorials/recorder/ Gatling quickstart tutorial]]
    • [[https://docs.gatling.io/tutorials/advanced/ Gatling advanced tutorial]]
      */
      class ComputerDatabaseSimulation extends Simulation {

val feeder = csv("search.csv").random

val search = exec(
http("Home").get("/"),
pause(1),
feed(feeder),
http("Search")
.get("/computers?f=#{searchCriterion}")
.check(
css("a:contains('#{searchComputerName}')", "href").saveAs("computerUrl")
),
pause(1),
http("Select")
.get("#{computerUrl}")
.check(status.is(200)),
pause(1)
)

// repeat is a loop resolved at RUNTIME
val browse =
// Note how we force the counter name, so we can reuse it
repeat(4, "i")(
http("Page #{i}").get("/computers?p=#{i}"),
pause(1)
)

// Note we should be using a feeder here
// let's demonstrate how we can retry: let's make the request fail randomly and retry a given
// number of times

val edit =
// let's try at max 2 times
tryMax(2)(
http("Form")
.get("/computers/new"),
pause(1),
http("Post")
.post("/computers")
.formParam("name", "Beautiful Computer")
.formParam("introduced", "2012-05-30")
.formParam("discontinued", "")
.formParam("company", "37")
.check(
status.is { session =>
// we do a check on a condition that's been customized with
// a lambda. It will be evaluated every time a user executes
// the request
200 + ThreadLocalRandom.current().nextInt(2)
}
)
)
// if the chain didn't finally succeed, have the user exit the whole scenario
.exitHereIfFailed

val httpProtocol =
http.baseUrl("https://computer-database.gatling.io")
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader(
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/119.0"
)

val users = scenario("Users").exec(search, browse)
val admins = scenario("Admins").exec(search, browse, edit)

setUp(
users.inject(rampUsers(10).during(10)),
admins.inject(rampUsers(2).during(10))
).protocols(httpProtocol)
}

Problem is as mentioned in title. on line 14 of this code. here:
class ComputerDatabaseSimulation extends Simulation {
Here bloop gives error.

@tgodzik
Copy link
Contributor

tgodzik commented Nov 28, 2024

Thanks for reporting! Looks like indeed something changed and the exported bloop json files do not contain proper scala configuration and the classpath contains different scala version artifacts, which will fail the compilation.

This needs to be fixed in https://github.com/scalacenter/bloop-maven-plugin though I will not have time to look at it soon :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants