Craig Ambrose
2005-Jun-17 01:01 UTC
Re: Why are fixtures loaded by a test class rather than a test method?
That''s not what I had in mind John. It''s more a matter of wanting to load different fixtures from different test methods, or sometimes no fixtures at all. For example, say that in one test I wanted to test the behaviour of my class under test if there were no model records in the database. This currently means that I need to either: - Not use fixtures anywhere in this test class - Explicitly remove the data that was loaded by the fixtures for this one test. - Move this test to a test class all by itself. I''m not a big fan of the last option, as I really like to have one test class per application class (otherwise I''d get confused). If I could, in one line of code, specifiy the fixture to load. Then I could easily have a few different fixtures for different situations for a given test class. I could give the fixture files sensible names and so I would know what data set I was testing against. Craig On Fri, 17 Jun 2005 11:06 pm, John Higgins wrote:> On 6/17/05, Craig Ambrose <craiga-aW5oDkNkUadaA94nB1n4cRCuuivNXqWP@public.gmane.org> wrote: > > Does having the same fixtures loaded for > > every test in the class bug anyone else? Because it''s driving me crazy. > > :) > > Actually your method of having to put the code for loading fixtures in > each test case seems a lot worse to me. If your tests are needing huge > fixtures with many different fixtures getting loaded - then why not > just create another test class? Not having to put the same code in > each test case is a blessing in my eyes....-- Craig Ambrose Web Elements http://www.portallus.com/people/craigambrose/
Craig Ambrose
2005-Jun-17 07:33 UTC
Why are fixtures loaded by a test class rather than a test method?
Hi folks, Is there any way to load a fixture from inside an test method, rather than at the at the test case class level. Does having the same fixtures loaded for every test in the class bug anyone else? Because it''s driving me crazy. :) Craig -- Craig Ambrose Web Elements http://www.portallus.com/people/craigambrose/
John Higgins
2005-Jun-17 13:06 UTC
Re: Why are fixtures loaded by a test class rather than a test method?
On 6/17/05, Craig Ambrose <craiga-aW5oDkNkUadaA94nB1n4cRCuuivNXqWP@public.gmane.org> wrote:> Does having the same fixtures loaded for > every test in the class bug anyone else? Because it''s driving me crazy. :) >Actually your method of having to put the code for loading fixtures in each test case seems a lot worse to me. If your tests are needing huge fixtures with many different fixtures getting loaded - then why not just create another test class? Not having to put the same code in each test case is a blessing in my eyes.... -- John W Higgins wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org