# run a test from IDE using App trait

**URL:** <https://community.gatling.io/t/run-a-test-from-ide-using-app-trait/1672>\
**Category:** Gatling (Open-Source)\
**Created:** [November 12, 2014, 12:14am UTC](https://community.gatling.io/t/run-a-test-from-ide-using-app-trait/1672 "2014-11-12T00:14:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krisztian\_Lachata](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@Krisztian\_Lachata](https://community.gatling.io/u/Krisztian_Lachata)\
**Post date:** [November 12, 2014, 12:14am UTC](https://community.gatling.io/t/run-a-test-from-ide-using-app-trait/1672/1 "2014-11-12T00:14:37Z")

</div>

Hi Guys,

I updated my project to use 2.1.0-SNAPSHOT version because I needed the latest websocket bug fix. Apart from some scala 2.11.4 issues and gatling api changes everything is ok now. I can run my test using sbt gatling:test.  
But in the stable version I could use something like this to start the test from intellij:

object CometDGatlingTest extends App {  
val gatlingPropertyBuilder = new GatlingPropertiesBuilder  
gatlingPropertyBuilder.simulationClass(classOf[CometDGatlingTest].getName)  
Gatling.fromMap(gatlingPropertyBuilder.build)  
}

class CometDGatlingTest extends Simulation with Logging {  
…  
}

In the new snapshot version I cannot do this as the api has changed.  
What is the best practice now to start a test programmatically with a specific test class?

Thx,  
Krisztian

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [November 12, 2014, 7:55am UTC](https://community.gatling.io/t/run-a-test-from-ide-using-app-trait/1672/2 "2014-11-12T07:55:53Z")

</div>

Hi Krisztian,

This method was removed a bit too fast. We were aware of it and planning to bring in back today, we just didn’t expect someone to be impacted so fast.  
[https://github.com/gatling/gatling/commit/204237dda052d7f907049a895b65f03c7575bbda](https://github.com/gatling/gatling/commit/204237dda052d7f907049a895b65f03c7575bbda)

We’re re-introducing it temporarily to ease maven archetype based projects, but it will be definitively dropped in 2.2.  
See deprecation message for migration.

Cheers,  
Stéphane

---

<div class="post-metadata">

**Author:** ![Krisztian\_Lachata](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@Krisztian\_Lachata](https://community.gatling.io/u/Krisztian_Lachata)\
**Post date:** [November 12, 2014, 8:41pm UTC](https://community.gatling.io/t/run-a-test-from-ide-using-app-trait/1672/3 "2014-11-12T20:41:15Z")

</div>

Hi,

Is it possible that something else has been changed as well?

Exception in thread “main” java.nio.file.NoSuchFileException: ./target/test-classes  
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)  
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)  
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)  
at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:426)  
at java.nio.file.Files.newDirectoryStream(Files.java:413)

I believe that not just the fromMap method changed which is responsible for being able to run the test like an App.  
I saw the same exception when I wanted to use the following:  
new Gatling(props.build, simulationClass).start

But it was OK in the stable version.

Thx,  
Krisztian

---

<div class="post-metadata">

**Author:** ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)\
**Post date:** [November 12, 2014, 8:57pm UTC](https://community.gatling.io/t/run-a-test-from-ide-using-app-trait/1672/4 "2014-11-12T20:57:37Z")

</div>

Hi,

This change comes from the refactoring I made to allow Gatling to upgrade to Scala 2.11.  
Gatling search the compiled classes in target/test-classes by default, but in your case, even if this folder does exist, the path is incorrect.  
You can, if you want, have a look at how the Maven Archetype fixes this :

[https://github.com/gatling/gatling-maven/blob/master/gatling-highcharts-maven-archetype/src/main/resources/archetype-resources/src/test/scala/IDEPathHelper.scala](https://github.com/gatling/gatling-maven/blob/master/gatling-highcharts-maven-archetype/src/main/resources/archetype-resources/src/test/scala/IDEPathHelper.scala)  
[https://github.com/gatling/gatling-maven/blob/master/gatling-highcharts-maven-archetype/src/main/resources/archetype-resources/src/test/scala/Engine.scala](https://github.com/gatling/gatling-maven/blob/master/gatling-highcharts-maven-archetype/src/main/resources/archetype-resources/src/test/scala/Engine.scala)

But it’ll be faster to simply copy those classes from the archetype into your project and run the Engine class 😉

Side note :  
Since you’re using 2.1 snapshots, you may like the fact that the mute mode (not asking for simulationID nor run description) works everywhere, and not only for the SBT plugin.  
If you activate it (gatlingPropertyBuilder.mute()), your simulation would now run right away, without asking for inputs. In short, faster development cycles for free 🙂

Cheers,

Pierre

---

<div class="post-metadata">

**Author:** ![Krisztian\_Lachata](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@Krisztian\_Lachata](https://community.gatling.io/u/Krisztian_Lachata)\
**Post date:** [November 12, 2014, 9:32pm UTC](https://community.gatling.io/t/run-a-test-from-ide-using-app-trait/1672/5 "2014-11-12T21:32:45Z")

</div>

Hi Pierre,

I remembered that there was an Engine and a IDEPathHelper long time ago and I used to use them from gatling 1.5. But since I updated to gatling 2 I couldn’t find them.  
Thanks the update.

Cheers,  
Krisztian

---

<div class="post-metadata">

**Author:** ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)\
**Post date:** [November 12, 2014, 9:43pm UTC](https://community.gatling.io/t/run-a-test-from-ide-using-app-trait/1672/6 "2014-11-12T21:43:01Z")

</div>

It has always been there 😉  
But when we migrated Gatling from Maven to SBT, the projects necessarily relying on Maven (e.g. our Maven plugin and archetype) were moved to their own repositories, and unified in 2.1 in single gatling-maven repository.

---

<div class="post-metadata">

**Author:** ![Krisztian\_Lachata](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@Krisztian\_Lachata](https://community.gatling.io/u/Krisztian_Lachata)\
**Post date:** [November 13, 2014, 10:58am UTC](https://community.gatling.io/t/run-a-test-from-ide-using-app-trait/1672/7 "2014-11-13T10:58:19Z")

</div>

Thx the help anyway.

@Stephane you can remove the fromMap method as it is not used.

k

---

<div class="post-metadata">

**Author:** ![Pierre\_DAL-PRA](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pierre\_DAL-PRA](https://community.gatling.io/u/Pierre_DAL-PRA)\
**Post date:** [November 13, 2014, 10:21pm UTC](https://community.gatling.io/t/run-a-test-from-ide-using-app-trait/1672/8 "2014-11-13T22:21:13Z")

</div>

I realized a bit too late that removing ‘fromMap’ was a really bad idea…  
On master, there is now ‘fromMap’ and ‘fromArgs’ to start Gatling, and the older ‘runGatling’ is now deprecated.
