Fixtures added functionality

I had noticed that fixtures become hard to use in big projects, particularly for functional testing. I was thinking about implementing in core rails something in the lines of:

- Named fixtures. You could name your fixture after what it provides, not necessarily after the table name. Examples of fixtures names would be: default_user_accounts, test_products, sell_history.

- Fixture dependencies. You could say that one of your fixtures "depends" on others, this way, they would all get loaded automatically whenever you load the "dependent". The loading would use standard topological sort to satisfy all dependencies. Maybe we can add some automatic dependency detection afterwards. Examples of dependencies: login_history depends on user_accounts, default_roles and roles_features; sell_history depends on products and price_lists.

- Fixtures sets. You could name a set of fixtures and load all of them (at its dependencies) at once. For instance, you could load login_framework, or history_tracking, or accountability.

Do you think this would help, any interest on it. Am I missing something and there is already a way to get this (or similar) functionality?

You might take a look at Fixture Scenarios rather than reimplementing a lot of those features:

  Google Code Archive - Long-term storage for Google Code Project Hosting.

Great, that seems to cover a part of it, thank you. And they are using a "Jorge Luis Borges" user in the example ... how could it be better?

Don't you think some of this functionality should come up to native Rails? Or is it OK in a plugin?

It's definitely plugin material. The fixtures thing is far from solved.

Personally, I don't really use fixtures (mocks and stubs ftw)

courtenay