How do we check results against feed column

Hello,

Assuming you have a feed file that looks like this:

count,userid,documentids
23,15026573-5B91-DF11-9372-001CC448DA6A,CD5E9EAB-4E91-DF11-9372-001CC448DA6A
19,A6026573-5B91-DF11-9372-001CC448DA6A,8D820B44-A68B-E011-8C10-001CC448DA6A

And you get back a json array of guids:

[“CD5E9EAB-4E91-DF11-9372-001CC448DA6A”,“AB5E9EAB-4E91-DF11-9372-001CC448DA6C”]

How do I add a check to see if the number of guids returned matches the count in the feed file?
I tried this, but it doesn’t seem to work:

.check(status.is(200))
.check(regex("["][A-Z0-9-]*["]")
.count.is("${count}".toInt)

The ${count} doesn’t properly convert to an Integer, I think it may be not found.

Any pointers to the right way to do this?

Thanks,
Max

“${count}”.toInt cannot work, you’re telling scala to convert the “${count}” String into an Int, even before it gets a chance to be passed to the EL compiler.

We’ll make this easier in Gatling 2.

You can convert when creating the feeder:

csv(“search.csv”).map {

_.map {

case (key, value) => key match {

case “count” => (key, value.toInt)

case _ => (key, value)

}

}

}.toArray

Cheers,

Stéphane

}

}.toArray

Thanks, but I’m still not sure how to connect that to the check:

.check(regex("["][A-Z0-9-]*["]")
.count.is(???)

Aw man…
.count.is("${count}") only works in master/Gatling 2.

In Gatling 1.4.X, in this case, you have to manually retrieve the attribute from the Session:

.count.is(session => session.getTypedAttributeInt)

Cheers,

Stéphane

Awesome, thanks Stephane!