locustio/locust — pull request #74 by heyman (2013-05-16 14:47:51+00:00)
Title: Stats refactoring

I've done a quite large refactoring of how the request statistics are stored internally.

I've broken out large parts of the RequestStats class into a StatsEntry class. The reason for this is that previously the RequestStats class was actually doing two different things. On the global class level, it was holding the global, aggregated stats, while on the instance level it was tracking statistics for single urls/stats entries. Now RequestStats should be instantiated and holds the global stats, as well as a dict of StatsEntry instances which holds the stats for single stats entries (URLs)

This should also be the first step of removing some global state in Locust, which is nice because we will be able to test things better. We might also facilitate it when we implement the support for different Clients (if we choose to use dependency injection for providing the Clients with the ability to report requests that are made).

I've also implemented some tests for the web UI, which I think will be a great starting point to write more tests and get more test coverage in that area.

In general, I'm quite happy with the result, but since it's a large refactoring, I would love to have a second pair of eyes on the changes :) (ping @Jahaja @cgbystrom)