0

How can I fill database with test data in Zope 3 project? I want this data to be loaded before any tests began (doctest, unit test...), I don't want to load it manually in SetUp methods...Thanks!

Gleb
  • 731
  • 1
  • 8
  • 14
  • There is too little information here to help you, I fear. How do you run your tests now, how do you set up your data, are these integration or function tests? Do you know about test layers, or the ZODB DemoStorage? In short, what have you tried and what hasn't worked but what has? – Martijn Pieters Jul 05 '12 at 09:47
  • I'm new to zope, so I just want to know other ways (and names of this ways for further googling) of setting db data before tests. I want to use some kind of fixtures, but I can't find nothing about this. – Gleb Jul 06 '12 at 06:12
  • Here's a start: http://wiki.zope.org/zope2/TestLayersHowTo/. You are looking for test layers; setUp and tearDown for a group of tests. – Martijn Pieters Jul 06 '12 at 06:18
  • Thanks. You can post this comment as an answer. So, there are no fixtures-way? Like in Django, or (Java)Play! Framework and others? – Gleb Jul 09 '12 at 11:44
  • `test fixtures` is a generic term for setting up and tearing down. Test layers is an implementation of that, as are the `setUp` and `tearDown` methods of the unittest.TestCase class. – Martijn Pieters Jul 09 '12 at 11:48

1 Answers1

1

Here's a start: http://wiki.zope.org/zope2/TestLayersHowTo/.

You are looking for test layers; setUp and tearDown for a group of tests, so you can set up your test fixtures for more than one test at a time. Test layers also let you create layers of test fixtures; one layer depending on another.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343