feeder that makes a http call?

861 views
Skip to first unread message

Stig Brautaset

unread,
May 11, 2013, 6:26:27 PM5/11/13
to gat...@googlegroups.com
Is there a way to make use of gatling's existing ability to make http calls (and perhaps even access the http baseUrl stuff) in a feeder? I want to create a feeder that obtains authenticated test-users using a special HTTP POST call on the service I'm testing. 

Why not simply create the user as part of the scenario, you ask? I already do that, for some scenarios. However, I now want to find out how my system behaves in the presence of supernodes so want to create a (comparatively) small number of ultra-connected users. I plan to use a feeder to create the supernodes, and make each of the (much more numerous) regular users follow a few of the supernodes at random. 

Any help appreciated! A custom feeder is the best I've come up with so far, but there might be better ways to do this.

Stig

Stéphane Landelle

unread,
May 12, 2013, 2:36:02 AM5/12/13
to gat...@googlegroups.com
Hi Stig,

I'm not sure I understand: do you want to create new users on the fly during the Simulation run, or just retrieve them from the system?



2013/5/12 Stig Brautaset <sbrau...@gmail.com>

Stig

--
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/groups/opt_out.
 
 

Stig Brautaset

unread,
May 12, 2013, 6:10:47 AM5/12/13
to gat...@googlegroups.com
I want to create new users during the simulation run. (My service has a special API call that I can activate that allows me to create authenticated users for testing, tagged with a test session id. They're normal users, but for this extra test session id tag, so a single "delete test users with this test session id" deletes all the test users and their relationships & data.)

I suppose I could create the supernode users up front and populate a CSV file, but I thought the custom feeder was a more elegant approach. It saves having to do multi-step run procedures if I can just run the gatling script and it sets up the data it needs.

As an aside, is there a tearDown() / cleanUp() step that will run after all the scenarios in setUp has finished? I'd love to hook my "delete test users" call in at that point.

Stig

Stéphane Landelle

unread,
May 12, 2013, 7:44:28 AM5/12/13
to gat...@googlegroups.com
Regarding users creation, you'd better no do that during the run, but when the Simulation instance is created. You can call such code in the Simulation class body. Gatling HTTP DSL can't be used for this, but you can use the underlying async-http-client engine:
I guess you can then build a custom feeder and set up the total number of users from what you'll get out of your REST API.


Regarding tear down hook, you can register one on the Akka Actor system's shutdown:
  • io.gatling.core.action.system.registerOnTermination
Cheers,

Stéphane

2013/5/12 Stig Brautaset <sbrau...@gmail.com>

har...@box.com

unread,
Jan 8, 2014, 2:30:28 AM1/8/14
to gat...@googlegroups.com
Hi Stéphane, I am trying to follow your advice to register teardown, but I cant do it in the definition of the simulation because the akka system has not been started. In Runner.scala you have the following sequence:

                        val simulation = simulationClass.newInstance
                        GatlingActorSystem.start

The instance of the class is instantiated and the registration code is executed before the Akka Actor system is initialized, causing an exception. Please advise. 
FYI, I am on 2.0.0-SNAPSHOT while I await the M4 release.

Thanks
Harold.

Stéphane Landelle

unread,
Jan 8, 2014, 3:21:07 AM1/8/14
to gat...@googlegroups.com
Hi Harold,

I think I'll add those hooks for M4.
For now, they will be very simple, meaning that signature will be () => Unit.
Is it OK?


2014/1/8 <har...@box.com>

har...@box.com

unread,
Jan 8, 2014, 4:40:43 AM1/8/14
to gat...@googlegroups.com
Thanks, () => Unit is perfect.

Stéphane Landelle

unread,
Jan 8, 2014, 12:28:41 PM1/8/14
to gat...@googlegroups.com
Will try to implement this tomorrow: https://github.com/excilys/gatling/issues/1475


2014/1/8 <har...@box.com>
Reply all
Reply to author
Forward
0 new messages