Anatomy of a Grinder test-script

This is my second post regarding Grinder. In this post I’ll go over the anatomy of a recorder Grinder test-script. If you haven’t read my previous post, please take a look at it. Otherwise this post won’t make much sense!

High-level structure of a Grinder script

The high-level structure of a recorded Grinder-test-script looks like this:

[
...
import statements
...
]

[
...
header definitions
...
]

[
...
url definitions
...
]

[
...
request and test definitions
...
]

class TestRunner:
     [
     ...
     method definitions - a method is defined for each recorded page
     ...
     ]

     def __call__(self):
     [
     ...
     calls to defined methods, which actually runs the requests
     ...
     ]

     [ utility function (I'll go over this later) ]

     [
     ...
     calls to utility function to wrap/instrument tests (I'll go over this later)
     ...
     ]

Read the rest of this entry »