Setup/teardown

268 views
Skip to first unread message

Chris Carrier

unread,
Apr 25, 2012, 3:47:01 PM4/25/12
to gat...@googlegroups.com
Is there any mechanism in Gatling for handling logic that you want
executed once at the beginning/end of the test? I would like my tests
to be able to prepare their own data and clean up after themselves but
I'm not sure the best way to run some code only once globally. I
suppose I could use (misuse?) a custom feeder for the setup something
like:

val setupFeeder = new Feeder() {
val customer = //create and return customer
val content = //create and return content
def next = {
Map("customerId" -> customer.id, "contentId" -> content.id)
}
}

In this case my feeder would always return the same data and I could
refer to ${customerId} and ${contentId} in my tests. Of course that
doesn't really help with cleanup. Is there a better way to approach
setup and teardown of data needed for tests?

Chris

Stéphane Landelle

unread,
Apr 25, 2012, 3:59:47 PM4/25/12
to gat...@googlegroups.com
Hi Chris,



Cheers,

Steph

2012/4/25 Chris Carrier <ctca...@gmail.com>

Is there any mechanism in Gatling for handling logic that you want
executed once at the beginning/end of the test?
No
 
I would like my tests to be able to prepare their own data and clean up after themselves but
I'm not sure the best way to run some code only once globally.
 
What I usually do is developing scripts in charge of restoring state (disk image, database backup, etc...) and have a super script that will launch them, and then the stress tool.
It doesn't feel right to do it in the stress tool, depending on your use case, you might have to restore a database, mockup some services, etc...
Reply all
Reply to author
Forward
0 new messages