# content check?

**URL:** <https://community.gatling.io/t/content-check/527>\
**Category:** Gatling (Open-Source)\
**Created:** [August 2, 2013, 3:14pm UTC](https://community.gatling.io/t/content-check/527 "2013-08-02T15:14:29Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edd\_Stance](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@Edd\_Stance](https://community.gatling.io/u/Edd_Stance)\
**Post date:** [August 2, 2013, 3:14pm UTC](https://community.gatling.io/t/content-check/527/1 "2013-08-02T15:14:29Z")

</div>

Hi

any help on this.

what im trying to do…

get - [blah.com/blah.php](http://blah.com/blah.php)  
check - status 200  
check content “blabla” - if its there KO the request

so i’ve got this in my scala file

> > .exec(http(“/dingdong”)
> 
> > .get(“/dingdong”)
> 
> > .headers(headers\_1)
> 
> > .check(status.is(200))
> 
> > .check(regex(“NO DONG BOOO.”).notExists)

so when a page is up and running properly it will display random information… but if it goes down it will have the same info displayed in example case -NO DONG BOOO - when i run the test i need this to fail if the no dong booo is in response/content.

why doesn’t this work?

thanks

Ed

---

<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:** [August 2, 2013, 3:22pm UTC](https://community.gatling.io/t/content-check/527/2 "2013-08-02T15:22:10Z")

</div>

No idea, should work.  
Stacktrace? Message?

---

<div class="post-metadata">

**Author:** ![Edd\_Stance](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@Edd\_Stance](https://community.gatling.io/u/Edd_Stance)\
**Post date:** [August 2, 2013, 3:45pm UTC](https://community.gatling.io/t/content-check/527/3 "2013-08-02T15:45:49Z")

</div>

all of the script if this helps of course…

---

<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:** [August 2, 2013, 3:55pm UTC](https://community.gatling.io/t/content-check/527/4 "2013-08-02T15:55:22Z")

</div>

Do you have any message?

---

<div class="post-metadata">

**Author:** ![Edd\_Stance](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@Edd\_Stance](https://community.gatling.io/u/Edd_Stance)\
**Post date:** [August 2, 2013, 4:05pm UTC](https://community.gatling.io/t/content-check/527/5 "2013-08-02T16:05:22Z")

</div>

nothing at all, as if the actual line of code is ignored?!

---

<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:** [August 2, 2013, 4:26pm UTC](https://community.gatling.io/t/content-check/527/6 "2013-08-02T16:26:40Z")

</div>

I did a quick test, it seems to work fine for me, sorry.

---

<div class="post-metadata">

**Author:** ![Edd\_Stance](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@Edd\_Stance](https://community.gatling.io/u/Edd_Stance)\
**Post date:** [August 2, 2013, 4:40pm UTC](https://community.gatling.io/t/content-check/527/7 "2013-08-02T16:40:45Z")

</div>

really odd, what version of gatling did you test it on? 🙂

Ta

Ed

---

<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:** [August 2, 2013, 4:54pm UTC](https://community.gatling.io/t/content-check/527/8 "2013-08-02T16:54:43Z")

</div>

1.5.2

---

<div class="post-metadata">

**Author:** ![Edd\_Stance](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@Edd\_Stance](https://community.gatling.io/u/Edd_Stance)\
**Post date:** [August 9, 2013, 9:51am UTC](https://community.gatling.io/t/content-check/527/9 "2013-08-09T09:51:20Z")

</div>

Hello again! 🙂 thanks for the help, got it working not sure why but i get the proper result now.

another question and probably not the last one either, is there a way to run a certain simulation from console with one line of code? something like

./gatling.sh mysimulation

click enter and it runs mysimulation.scala?

---

<div class="post-metadata">

**Author:** ![Edd\_Stance](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@Edd\_Stance](https://community.gatling.io/u/Edd_Stance)\
**Post date:** [August 13, 2013, 9:33am UTC](https://community.gatling.io/t/content-check/527/10 "2013-08-13T09:33:47Z")

</div>

Back again, dumbo me didn’t think of reading the docs 🙂 found a way to run it.

another question that i seriously can’t find an answer to in the docs is this;

i want to run a simulation and at the end of it i want gatling to run an action/job kinda thing if it receives a KO after running a test.

for e.g. run test - get KO - email result to [bigshotz@email.com](mailto:bigshotz@email.com)

is this possible or are we going to need to write an extra script for that? 🙂

thanks for support btw.

Ed

---

<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:** [August 13, 2013, 9:50am UTC](https://community.gatling.io/t/content-check/527/11 "2013-08-13T09:50:50Z")

</div>

Hi Edd,

There is no built-in that allows you to do that, sorry.

However, you can implement it yourself pretty easily :

- add some assertions ([https://github.com/excilys/gatling/wiki/Assertions](https://github.com/excilys/gatling/wiki/Assertions)) to your simulation to specify your failure criteria.
- Wrap Gatling launch with a bash script (or anything you’d like) start Gatling, wait for your simulation to finish and get the exit code
- If the exit code was 0, everything went fine and your simulation suceeded according to your assertions. If the error code was 2, then one or multiple assertions failed, and you cand send your email to notify the simulation failure.  
Cheers,

Pierre

---

<div class="post-metadata">

**Author:** ![Edd\_Stance](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@Edd\_Stance](https://community.gatling.io/u/Edd_Stance)\
**Post date:** [August 13, 2013, 10:15am UTC](https://community.gatling.io/t/content-check/527/12 "2013-08-13T10:15:05Z")

</div>

Thank you! sounds good, will give it a shot and see how it works.

Ed

---

<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:** [August 13, 2013, 7:14pm UTC](https://community.gatling.io/t/content-check/527/13 "2013-08-13T19:14:38Z")

</div>

By the way, you could achieve the same goal using Gatling’s Maven Plugin and Jenkins plugin.

You’d only need to setup some assertions and a bit of configuration on the Jenkins side.  
If one or more assertions failed, the Maven build would fail which in turn would make the Jenkins build fail. You’d need to configure Jenkins to send an email if a build fails.  
However, if you’re not already using Maven and Jenkins, a custom script would be much simpler of course.

Cheers,

Pierre
