Skip to content

Instantly share code, notes, and snippets.

@groovybayo
Last active November 7, 2022 06:47
Show Gist options
  • Star 28 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save groovybayo/4691670 to your computer and use it in GitHub Desktop.
Save groovybayo/4691670 to your computer and use it in GitHub Desktop.
Gatling: Step by step guide to IntelliJ integration

Step by step guide to setting up IDEA to write gatling simulations

Prerequisites:

Have SBT plugin installed

Begin

create project

add archetype

  • Select the newly create archetype and click next
  • Click Finish button to complete project creation

finish project

If all goes well, the project will be set up and ready to use

Recorder.scala - run this to launch the gatling recorder to record simulations

Engine.scala - run this to execute existing simulations

Reference

Gatling IDE integration

Troubleshooting

When creating the archetype, even though IDEA says the repository is optional, it is important you specify the one for the gatling archetype. This is because gatling archetype is not hosted on maven central and if you fail to provide the URL (http://repository.excilys.com/content/groups/public), you will end up with error like

Downloading: 
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml 
Downloaded: 
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml 
(701 B at 2.7 KB/sec) 
[INFO] 
[INFO] 
------------------------------------------------------------------------ 
[INFO] Building Maven Stub Project (No POM) 1 
[INFO] 
------------------------------------------------------------------------ 
[INFO] 
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ 
standalone-pom >>> 
[INFO] 
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ 
standalone-pom <<< 
[INFO] 
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ 
standalone-pom --- 
[INFO] Generating project in Batch mode 
[INFO] Archetype defined by properties 
Downloading: 
http://repo.maven.apache.org/maven2/com/excilys/ebi/gatling/highcharts/gatling-highcharts-maven-hetype/1.3.0/gatling-highcharts-maven-archetype-1.3.0.jar 
[INFO] 
------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] 
------------------------------------------------------------------------ 
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-archetype-plugin:2.2:generate 
(default-cli) on project standalone-pom: The desired archetype does 
not exist 
(com.excilys.ebi.gatling.highcharts:gatling-highcharts-maven-archetype:1.3.0) 
-> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with 
the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, 
please read the following articles: 
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 

For command line lovers

You can also generate the archetype from the command line directly using

mvn archetype:generate \
-DarchetypeCatalog=http://repository.excilys.com/content/groups/public/archetype-catalog.xml

and then import it as a maven module from within IntelliJ. A longer way to archieve the same thing :)

@holyjak
Copy link

holyjak commented Nov 8, 2013

Very useful, thank you!

Some updates as of 11/2013:

  • The latest groupId:artifactId of the archetype is io.gatling.highcharts:gatling-highcharts-maven-archetype, the latest version is 2.0.0.20130628 (it is very easy to get these using the command-line version of the instructions)
  • The Recorder.scala and Engine.scala are under src/test/scala (and not main as I thought)

Also, it wasn't clear to me that I have to put my recorded simulations under src/test/scala/user-files/simulations/ (optionally with a package).

  • mvn test failed the first time I tried it due to missing dependencies but then it worked (perhaps just a temporary problem in my env.)

Copy link

ghost commented Jul 15, 2014

Latest version now 2.0.0-M3a

@alteclanser
Copy link

Holy Shiza I finally got this to work. I kept getting Compiler not selected with no scala compiler in the drop down list.

What I did was removed the Scala Faucet.

Then right clicked in the project and "Add Framework Support"

Then went back to faucet and added scala-compiler in the drop down.

Then rebuilt project and it worked!!!!!!!!!!!!!!!!!!!

Great guide by the way!

@krishnapujara
Copy link

The archetype version 1.4.2 not working. We tried with version 1.5.6 and it worked fine..Cheers!

@jold
Copy link

jold commented Mar 19, 2015

make sure you've patch your new IntelliJ Idea 14, otherwise the project won't be generated

https://youtrack.jetbrains.com/issue/IDEA-137783

@cirocosta
Copy link

For anyone wondering what's the recent version, archetype, etc, check this: http://repository.excilys.com/content/groups/public/archetype-catalog.xml

@c-bass
Copy link

c-bass commented May 6, 2016

I found this to be the most recent and accurate documentation: http://gatling.io/docs/2.2.0/extensions/maven_archetype.html

@benwck
Copy link

benwck commented Sep 1, 2016

Archetype working now:
GroupId: io.gatling.highcharts
ArtifactId: gatling-highcharts-maven-archetype
Version: 2.2.0
Repository:

http://search.maven.org/#artifactdetails%7Cio.gatling.highcharts%7Cgatling-highcharts-maven-archetype%7C2.2.0%7Cmaven-archetype

@gujko
Copy link

gujko commented Jan 18, 2017

Archetype working now:
GroupId: io.gatling.highcharts
ArtifactId: gatling-highcharts-maven-archetype
Version: 2.2.1

@deividbatfish2
Copy link

Archetype working now:
GroupId: io.gatling.highcharts
ArtifactId: gatling-highcharts-maven-archetype
Version: 3.1.1

@henriquetorquato
Copy link

Archetype working now:
GroupId: io.gatling.highcharts
ArtifactId: gatling-highcharts-maven-archetype
Version: 3.4.1

You can check out all the future versions for this archetype here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment