I have added a simulation code under simulations folder but while running gatling.bat, it is not detecting simulation which i added. When i select run local simulation, it is only detecting simulation which comes with gatling bundle distribution.
How can i add a simulation file and run it using command line?
Hi @saxenaj,
Welcome aboard!
Please, help us to help you.
Which filename? which content?
Did you check the output? Specifically about pathes (java path, and gatling home, to ensure that is the right one and not another installation that is started)
Cheers!
I have added a file with name TestSimulation.java under \simulations\mypackage\TestSimulation.java. This file is just hitting a local endpoint url. I have run the same file using gradle plugin and able to run the simulation successfully. I have verified the path and able to run gatling.bat successfully as I run computerDatabaseSimulation and getting the expected results.
I don’t reproduce your issue.
Steps I tried:
-
Download the latest bundle from Gatling official Open Source site.
-
Unzip it
-
Add a file under
gatling-charts-highcharts-bundle-3.8.4/user-files/simulations/mypackage/MySimulation.java
with content:package mypackage; import static io.gatling.javaapi.core.CoreDsl.*; import static io.gatling.javaapi.http.HttpDsl.*; import io.gatling.javaapi.core.*; import io.gatling.javaapi.http.*; public class MySimulation extends Simulation { HttpProtocolBuilder 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"); ScenarioBuilder scn = scenario("Sample").exec( http("ping").get("/") ); { setUp( scn.injectOpen(rampUsers(3).during(10)) ).protocols(httpProtocol); } }
-
Launch
bin/gatling.sh
Output:
GATLING_HOME is set to /tmp/gatling-charts-highcharts-bundle-3.8.4
Do you want to run the simulation locally, on Gatling Enterprise, or just package it?
Type the number corresponding to your choice and press enter
[0] <Quit>
[1] Run the Simulation locally
[2] Package and upload the Simulation to Gatling Enterprise Cloud, and run it there
[3] Package the Simulation for Gatling Enterprise
[4] Show help and exit
1
Choose a simulation number:
[0] computerdatabase.ComputerDatabaseSimulation
[1] mypackage.MySimulation
As you can see, Gatling finds my new simulation.
I cannot test with windows (ie gatling.bat
) because I don’t have any windows available.
Can you describe the steps you did (as explicit as I did)?
Question: why do you still use our bundle if you know how to use the gradle? Our bundle is mainly for people that don’t use or don’t know how to use a packager (sbt, gradle, maven).
Cheers!
Thanks sbrevet. I followed the same steps and wondering why it was not working on my windows laptop. I deleted the target folder and run it again. It worked fine now. Thanks for your proactive responses and help.
Perhaps a permissions issue?
Happy to help!
Cheers!