Recorder test structure

Hey me again. I'm going to create a new thread for feature ideas so
each can be discussed independently. So let me know if I'm creating
too much noise on the list.

I've found the recorder really useful for creating tests from web
flows. Of course I then have spent a bunch of time hacking on the
resulting tests and I found after a little refactoring my tests were a
bit more readable. I was curious if the recorder could be made to
output the tests in a way that would make them easier to manage. I
have some tests that have quite a few requests in them and right now a
recorded test looks something like:

class Simulation extends GatlingSimulation {

val urlBase = ...
val httpConf = httpConfig.baseURL(urlBase)

//zillion lines of headers

//zillion lines of chains

val scn = //adding chains

runSimulation(...)

}

The result is that one has to scroll through a bunch of lines of
headers and stuff that won't change very much to get to the important
stuff which is the scenario definition and scn.configure call. I
refactored my test to look like this:

class Simulation extends GatlingSimulation with Chains {

val scn = //adding chains

runSimulation(...)

}

trait Chains extends Headers {

//zillion lines of chains

}

trait Headers {

//zillion lines of headers

}

This way the first thing I see when I open the file is the test setup
and execution. There are other ways to do something like this.
Chains could self type Headers and then both could be mixed into the
main simulation. This obviously isn't crucial but may lead to more
readable tests.

Thanks!
Chris

Hi Chris!

First thanks for the blog post (I assume it was you that wrote it on zubrenace eng’s blog :p) :slight_smile:

Then concerning your idea, it is a good one! I’m working on refactoring the recorder (when I have some time free :p) And I think I’ll consider adding an option for this feature.

I’ve got a question though: Why traits? Shouldn’t imports and objects be clearer? :slight_smile:

Again thanks for your input.

Cheers,
BluePyth

Hi,

I like the idea of having things more structured, but I also like the idea of not forcing it on users, so we should make it an option (like selecting a template from a drop down menu).

As Romain stated, let’s define the more suitable template first.

Cheers,

Steph

2012/2/17 Romain Sertelon <bluepyth@gmail.com>

There's no real reason for traits. My goal was just to get some of
the boiler plate stuff that I wasn't really changing out of the way
since I was mostly going in and changing the users/ramp and
occasionally tweaking which chains I was including. Like you say
there are many ways one could do that. I don't use an IDE right now
when working on Gatling scripts so also wanted to keep everything in
one file.

And yeah that was my post. You guys found it fast!

Chris

2012/2/17 Chris Carrier <ctcarrier@gmail.com>

There’s no real reason for traits. My goal was just to get some of
the boiler plate stuff that I wasn’t really changing out of the way
since I was mostly going in and changing the users/ramp and
occasionally tweaking which chains I was including. Like you say
there are many ways one could do that. I don’t use an IDE right now
when working on Gatling scripts so also wanted to keep everything in
one file.

I like the idea of sorting things out, I’ll try to think of something next week.

And yeah that was my post. You guys found it fast!

Big Brother’s watching you! And Google too!