fixtures

Retrieving specific fixtures in Rails

I have a YML file containing fixtures for a Rails model (Comment) which looks like this (pardon the formatting): comment_a: id: 1 text: 'foo' visible: false comment_b: id: 2 text: 'bar' visible: true comment_c: id: 3 text: 'baz' visible: true I know that I can select an individual Comment fixtur...

Loading fixtures in django unit tests

I'm trying to start writing unit tests for django and I'm having some questions about fixtures: I made a fixture of my whole project db (not certain application) and I want to load it for each test, because it looks like loading only the fixture for certain app won't be enough. I'd like to have the fixture stored in /proj_folder/fixtur...

How might you make a Rails test fixture persistent between tests?

I have a good half-dozen fixtures in my Rails test suite - some quite large - that represent static look-up tables in the database. Since their values theoretically don't change, I'd like to save the time of wiping and reloading the tables between each test. Is there a trick/plug-in/gem/hack to demarcate these fixtures as only needing ...

Friendly_id for fixtures (slugs)

I am using freindly_id in my application. I have setup a few fixtures in my application. I want to do integration testing on them. During the tests I need the friendly_id, but the DB records created from fixtures do not have the corresponding slugs in the Slug table. Aren't the slugs automatically created from Fixture data? If not then...

Django unit-testing with loading fixtures for several dependent applications problems

Hello! I'm now making unit-tests for already existing code. I faced the next problem: After running syncdb for creating test database, Django automatically fills several tables like django_content_type or auth_permissions. Then, imagine I need to run a complex test, like check the users registration, that will need a lof ot data tables...

In a Rails unit test, how can I get a User fixture to load its associated Profile?

In the documentation concerning Fixtures (http://api.rubyonrails.org/classes/Fixtures.html) they provide the following example of using label references for associations: ### in pirates.yml reginald: name: Reginald the Pirate monkey: george ### in monkeys.yml george: name: George the Monkey pirate: reginald So following their...

How can I store HTML in a Doctrine YML fixture

I am working with a CMS-type site in Symfony 1.4 (Doctrine 1.2) and one of the things that is frustrating me is not being able to store HTML pages in YML fixtures. Instead I have to create SQL backups of the data if I want to drop and rebuild which is a bit of a pest when Symfony/Doctrine has a fantastic mechanism for doing exactly this....

Ruby on Rails: Accessing production database data for testing

With Ruby on Rails, is there a way for me to dump my production database into a form that the test part of Rails can access? I'm thinking either a way to turn the production database into fixtures, or else a way to migrate data from the production database into the test database that will not get routinely cleared out by Rails. I'd lik...

Migrate a Django project from MySQL to Oracle

Hi, I have a Django1.1 project that works with a legacy MySQL db. I'm trying to migrate this project to Oracle (xe and 11g). We have two options for the migration: - Use SQL developer to create a migration sql script. - Use Django fixtures. The schema created with the sql script from sql developer doesn't match the schema created from ...

Using fixtures with factory_girl

When building the following factory: Factory.define :user do |f| f.sequence(:name) { |n| "foo#{n}" } f.resume_type_id { ResumeType.first.id } end ResumeType.first returns nil and I get an error. ResumeType records are loaded via fixtures. I checked using the console and the entries are there, the table is not empty. I've found ...

Django: text fixture fails to load

Hi all, Did a dumpdata of my project, then in my new test I added it to fixtures. from django.test import TestCase class TestGoal(TestCase): fixtures = ['test_data.json'] def test_goal(self): """ Tests that 1 + 1 always equals 2. """ self.failUnlessEqual(1 + 1, 2) When running the test I get:...

JUnit Best Practice: Different Fixtures for each @Test

Hi I understand that there are @Before and @BeforeClass, which are used to define fixtures for the @Test's. But what should I use if I need different fixtures for each @Test? Should I define the fixture in the @Test? Should I create a test class for each @Test? I am asking for the best practices here, since both solutions aren't cl...

Any YAML based fixture loader for Java?

I've used DbUnit but after playing about with the Play Framework recently I've found it's Fixtures.load(String yamlFilename) really useful. Anyone know of a similar tool that can be used with any Java project? ...

Unit tests and fixtures

We have a bunch of unit tests which test a lot of webpages and REST API services. Currently when our tests run it pulls from these pages live but this can take ages to run sometimes, and it also feels like the tests should be testing more of our code - not just relying on them being up and responding (if that makes sense..). Is it bett...

Ruby on Rails 2.3.5: Populating my prod and devel database with data (migration or fixture?)

I need to populate my production database app with data in particular tables. This is before anyone ever even touches the application. This data would also be required in development mode as it's required for testing against. Fixtures are normally the way to go for testing data, but what's the "best practice" for Ruby on Rails to ship th...

Rails 2.3.5 table populated by fixtures at end of test run rather than at start

I start with a test database containing the schema but with no data in the tables. I run a test like so cd test/ ruby unit/directive_test.rb I get failures indicating that the code found no data in the data tables. However, I look at the tables after running that test and the data is now in the the table. In fact, if I immediately ru...

Grails fixtures

Hello, I was trying to use fixtures plugin for initial (seed)data loading.. the documentation seems very short.. can anyone give some details about 1. where to define all the data, and in which order 2. how to give complex data type (joda time, currency etc) 3. how to load the fixure data only once for the initial data thanks, ...

Grails build-test-data

Hello, Is it advisable to use the build-test-data plugin to load the bootstrap (seed/initial) data for an application. The plugin tutorial is excellent at http://bitbucket.org/tednaleid/grails-test-data/wiki/Home , but only mention about loading test data. There is a section about TestDataConfig , which allows to set default data. But is...

How can I automatically load fixtures into my development database but not my production database when using django-nonrel?

I'd like to load some test data into my development db but not put it into my production db. In django you can create database-specific fixtures using this mechanism: http://docs.djangoproject.com/en/dev/ref/django-admin/#database-specific-fixtures It is possible to do something similar with django-nonrel? ...

how to create default users on django init_data ?

How can I loaddata for default list of users, when I syncdb ? ...