val classPath = fullClasspath.all(scopeProjectA).value.flatten
def extractProjectAJar(toFolder: File) =
classPath.find(_.data.toURI.toURL.toString.endsWith(s"project-A-$VersionVehiclesGatling.jar"))
.map { jar => IO.unzip(new File(jar.data.toURI.toURL.getFile), toFolder)}
val targetFolder = target.in(gatlingTests).value.getAbsolutePath
val projectAExtractDir = new File(s"$targetFolder/projectAExtract")
IO.delete(projectAExtractDir)
projectAExtractDir.mkdirs()
extractProjectAJar(v)
System.setProperty("gatling.core.disableCompiler", "true")
runProject(
classPath,
None,
runJavaMain(
mainClassName = "io.gatling.app.Gatling",
args = Array(
"--simulation", "full.path.to.a.gatling.Simulation",
"--data-folder", s"${projectAExtractDir.getAbsolutePath}/data",
"--results-folder", s"$targetFolder/gatling",
"--request-bodies-folder", s"$targetFolder/request-bodies"
),
method = "runGatling"
)
) match {
case 0 => println("Gatling execution SUCCESS")
case exitCode =>
println("Gatling execution FAILURE")
throw new Exception(s"Gatling run exited with error $exitCode")
}
}
If anyone is trying to achieve the same thing I can give more details. The code is going to be open sourced soon anyway so it will be much easier to add references and examples.
Lucho
On Monday, July 28, 2014 4:43:55 PM UTC+1, Luchesar Cekov wrote:
Hi Pierre, actually helps a lot :) thanks! It is useful in a way that it verifies my suspicions and invalidates one of the directions I had as an option. The direction is running the Gatling simulations using the gatling-sbt plugin.