<p>I've got an application that needs quite a bit of data (1000s of records) to do appropriate testing.  The only way I've found to get a decent set of testable, sensible data is to use a <strong>subset of my production DB</strong>.  I've converted this to YAML fixtures in the normal `test/fixtures' location.</p>

<p>This works, but now I have a bunch of seemingly brittle tests and assertions that depend on their being a particular number of records that meet condition X...</p>

<p>example</p>

<pre><code>def test_children_association
  p = Parent.find(1)
  assert_equal 18, p.children.count, "Parent.children isn't providing the right records"
end
</code></pre>

<p>This doesn't seem like a good idea to me, but <strong>I'm not sure if there is a better / accepted  way</strong> to test an application that needs a large hierarchy of data.</p>

The first thing I'd say is: what are you testing in that example? If it's an ordinary AR has_many association, then I wouldn't bother writing a test for it. All you're doing is testing that AR works.
A better example might be if you had a very complicated query or if there was other processing involved in getting the list of children records. When you get them back, rather than testing for a count you could iterate through the returned list and verify that the children match the criteria you're using.