How to run Gatling from source

Hey there!)

I have some experience with the contribution to Gatling and during this I used simple tests to check new functionality, etc. But, currenlty I would like to run a scenario. A long time ago, if I clearly remember, I launched some scenarios, but unfortunately I forgot how.

Can you provide steps or instructions for that?

Thank you!

It’s not possible to run Gatling from sources. You have to compile the sources and publish them locally.

1 Like

Thanks for the answer!

I tried what you wrote but seems like I’m missing something. Can you please help me with the right direction. Here are my steps:

  1. Run sbt "clean;compile;test:compile;publishLocal"
  2. Get archive of the bundle by path $HOME/.ivy2/local/io.gatling/gatling-bundle/3.7.5-SNAPSHOT/zips/gatling-bundle-bundle.zip
  3. Unarchive

Then I saw there isn’t a folder with all dependencies .jar. Is there any way to compile and package all dependencies to the lib folder? Or do I need to create a script which will move all these?

If you want the complete bundle, you’ll have to publishLocal the gatling-highcharts project as well.

Note that you need to ensure they are at the very same version (as gatling-highcharts depends on gatling as same version).

1 Like

Okey, got it. Thank you!

I found solution. I created:

1) gatling-app/src/test/scala/Engine.scala:

import io.gatling.app.Gatling
import io.gatling.core.config.GatlingPropertiesBuilder

object Engine extends App {

	val props = new GatlingPropertiesBuilder()
		.resourcesDirectory(IDEPathHelper.mavenResourcesDirectory.toString)
		.resultsDirectory(IDEPathHelper.resultsDirectory.toString)
		.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString)

	Gatling.fromMap(props.build)
}

2) gatling-app/src/test/scala/IDEPathHelper.scala:

import java.nio.file.Paths

object IDEPathHelper {

	private val projectRootDir = Paths.get(getClass.getClassLoader.getResource("gatling.conf").toURI).getParent.getParent.getParent
	private val mavenTargetDirectory = projectRootDir.resolve("target")
	private val mavenSrcTestDirectory = projectRootDir.resolve("src").resolve("test")

	val mavenSourcesDirectory = mavenSrcTestDirectory.resolve("scala")
	val mavenResourcesDirectory = mavenSrcTestDirectory.resolve("resources")
	val mavenBinariesDirectory = mavenTargetDirectory.resolve("test-classes")
	val resultsDirectory = mavenTargetDirectory.resolve("gatling")
	val recorderConfigFile = mavenResourcesDirectory.resolve("recorder.conf")
}


3) gatling-app/src/test/scala/ExampleSimulation.scala (just example)
4) Set gatling.core.simulationClass = "ExampleSimulation" in gatling.conf
5) Add logback-test.xml
6) Run Engine.scala

Anyway, @slandelle @sbrevet thank you guys)