A recent project of mine has been testing with Random Walks. This was inspired by the random models of gases in statistical mechanics that models each particle of a gas as a simple entity obeying simple rules. My intention is to create a similar model for web applications - each user of the application is a simple entity that follows simple rules.
I work at a web application shop, so this model is designed primarily for webpages. It works quite well. The steps are:
- User GETs a page.
- User examines page and determines the next action.
- User either POSTs or GETs the next page.
- Follow redirects as necessary.
We now replace the user with a "Random Walker." The Walker talks to a "Browser" object that handles all of the communication with the server. We'll leave the details of the Browser to a future post (and believe me, the devil is in those details).
The Random Walker, at its simplest, scans through the HTML it gets and counts the number of links it could follow, plus the number of forms it could fill out. It then picks one action randomly. Links are the easiest - it requests a GET from the Browser for the new URL. In the case of forms, it analyzes the input fields (INPUTs, SELECTs, TEXTAREAs, etc) and computes a random form data string. It then requests a POST from the browser, with that form data.
Now we add some useful features. The Walker excludes actions that will take it off-site. If it finds 0 possible actions, it backs up to a point where it could have made a different choice.
We can run multiple walkers simultaneously to simulate real, random, user interaction. If you feel some actions are more likely than others, you can certainly add a weighting to the averages. Another good enhancement is data typing for form fields (although submitting invalid data is certainly realistic from actual users).
What you'll get out of this is an enormous log file of page hits and response times. Running some statistics and analysis can reveal some quality load data.
Next part: Getting the Browser object to work.

Comments