Custom check failure messages?

822 views
Skip to first unread message

John Arrowwood

unread,
Jan 14, 2015, 2:47:01 PM1/14/15
to gat...@googlegroups.com
I am trying to test to make sure that the application is not redirecting me to a particular page.  I do that like this:

      request
     
// if Location redirect is present
     
// ensure it is not the /security/not-eligible path
     
.check(
        header
("Location")
       
.transformOption( extract => extract match {
         
case None => Some(true)
         
case Some(x) => Some( ! x.contains( "/security/not-eligible" ) )          
       
})
       
.is( true )
       
)

When that happens, this is what I see in the logs:

Request 'login' failed: header(Location) transformOption.find(0).is(true), but actually found false


What I would really like to do is throw an error that says "Server redirected to /security/not-eligible".  Is that doable?

I'd actually like to be able to customize more than just this message, but I'm using this as an example.

Stéphane LANDELLE

unread,
Jan 14, 2015, 3:21:28 PM1/14/15
to gat...@googlegroups.com
Location header won't be available by default, as followRedirect is enabled.

Stéphane Landelle
Lead developer


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Arrowwood

unread,
Jan 14, 2015, 3:37:59 PM1/14/15
to gat...@googlegroups.com
I've disabled followRedirect.  And my check is working just fine.  I just want to change the error message into something meaningful.  Like I said, I'm using this as an example.  What I'd like to see is something like:

.check( condition, failureMsg )

Stéphane LANDELLE

unread,
Jan 14, 2015, 3:45:02 PM1/14/15
to gat...@googlegroups.com
Not currently doable, but that wouldn't be very hard to implement.
Feeling like contributing? ;)


Stéphane Landelle
Lead developer


John Arrowwood

unread,
Jan 14, 2015, 4:24:02 PM1/14/15
to gat...@googlegroups.com
Sure.  Any chance you could tell me where the extra parameter would need to be put?

Stéphane LANDELLE

unread,
Jan 14, 2015, 4:38:08 PM1/14/15
to gat...@googlegroups.com
In Check.

The thing is to decide the function signature: which input parameter? The default String message? The actual value?

Stéphane Landelle
Lead developer


Rodion Alukhanov

unread,
Feb 24, 2016, 7:39:52 AM2/24/16
to Gatling User Group
What is the status of this issue? Is it implemented (rejected)?

Stéphane LANDELLE

unread,
Feb 24, 2016, 7:42:01 AM2/24/16
to gat...@googlegroups.com
Not implemented. Contributions welcome.

Stéphane Landelle
GatlingCorp CEO


On Wed, Feb 24, 2016 at 1:39 PM, Rodion Alukhanov <rod...@alukhanov.ru> wrote:
What is the status of this issue? Is it implemented (rejected)?

--

Hooman Kamran

unread,
Jun 7, 2017, 12:24:31 AM6/7/17
to Gatling User Group
Hi,

Sorry for bumping an old topic but I'm curious if this has been implemented yet (using 2.2.5)? If not would it be fine if I can take a stab at it?

Viktor Farkas

unread,
Jun 15, 2017, 3:13:44 AM6/15/17
to Gatling User Group
Please do! I'm also looking for this feature for a while now :)
Viktor
Reply all
Reply to author
Forward
0 new messages