content check?

Hi

any help on this.

what im trying to do…

get - 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

No idea, should work.
Stacktrace? Message?

all of the script if this helps of course…

Do you have any message?

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

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

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

Ta

Ed

1.5.2

Hello again! :slight_smile: 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?

Back again, dumbo me didn’t think of reading the docs :slight_smile: 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

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

thanks for support btw.

Ed

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) 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

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

Ed

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