<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
A spent a couple of days in total looking at our developer tests and
their performance (I managed to get ruby-prof to profile a few test
suites, which was a great help. I have the files for those who are
interested).<br>
<br>
<br>
Some stats: we have 2280 or so tests. The total execution time of
all specs on my machine is about 14 minutes. About two thirds of
tests are slower than 0.1 sec. Majority, if not all tests in
spec/controllers access the db. In some test suites time spent on db
operations amounts to high 40-ties of total test run time. Tests in
spec/models have no clear separation between model and glue-layer
tests, besides context changes.<br>
<br>
<br>
Some areas of improvement:<br>
- Turn controller tests into real unit tests - isolate them from
the db. This will be easier if something like Factory-Girl [1] was
used<br>
for object graph generation.<br>
- we have a few tests that exercise views, perhaps they should be
moved out into a separate module, as they can be quite slow.<br>
- Break up model tests into:<br>
- tests that access db (test queries, etc)<br>
- tests that exercise orchestration logic. These will effectively
be unit-tests.<br>
<br>
<br>
Bryan: I think the stories can be broken by type of tests, either
one story per test-suite (ie controller tests, model tests), with
work broken up by model/controller. Alternatively, we could have one
story per test (ie modify systems_controller_spec, etc). Please let
me which is more convenient for you.<br>
<br>
<br>
Thoughts, opinions?<br>
-d <br>
<br>
<br>
<br>
[1]
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a href="https://github.com/thoughtbot/factory_girl">https://github.com/thoughtbot/factory_girl</a><br>
<br>
</body>
</html>