Easy test fixtures with DBIx::Class

2014-02-16 Thread Ovid
I wanted an easier way to create test fixtures with DBIx::Class, so I wrote it. I've written about it here:     http://blogs.perl.org/users/ovid/2014/02/easy-fixtures-with-dbix-class.html Since this is the QA group, I feel that you might appreciate this more than most. Bug reports and

RE: Fixtures

2007-02-16 Thread Ovid
--- Ovid <[EMAIL PROTECTED]> wrote: > Later, the 'Our::Test::Database' has a DESTROY method which drops the > database. At the beginning and end of every .t file, the database is > created from scratch and destroyed. I forgot to mention something very important if you use this technique. We cac

Re: Fixtures

2007-02-14 Thread Luke Closs
On 2/13/07, Kirrily Robert <[EMAIL PROTECTED]> wrote: can someone explain it to me *in a perlish way*. I think of fixtures as code that helps make testing data driven. I haven't used Test::Class (though I probably should sometime), but instead, I refactor my unit tests into t

Re: Fixtures

2007-02-14 Thread Adrian Howard
) so you can measure the luminosity and verify that it is within spec. So, the fixture gives you the surrounding environment (and/or related inputs, overrides CORE::GLOBAL::time and whatever), then your test just involves one chunk of code and the direct inputs to it. e.g. You might have seve

Re: Fixtures

2007-02-14 Thread Adrian Howard
ish? Wanna make something of it ;-) would anyone else be able to provide confirm that I'm making sense in the following Test::Harness/Test::More style example: 1. Assume a test file t/foo.t 2. Assume a directory t/data (or t/fixtures if you will -- I just call it data in my own tests). 3.

Re: Fixtures

2007-02-14 Thread Ovid
--- Thomas Klausner <[EMAIL PROTECTED]> wrote: > I guess with some more fiddling the END-block could be made smart > enough > to only tear down stuff that was actually set up, but it worked for > me... If you're using a DB, you can use transactions (AutoCommit => 0) and rollback at the end. If

Re: Fixtures

2007-02-13 Thread Thomas Klausner
Hi! On Wed, Feb 14, 2007 at 09:46:19AM +1100, Kirrily Robert wrote: > example used Test::Class's setup/teardown; would anyone else be able > to > provide confirm that I'm making sense in the following > Test::Harness/Test::More style example: I had to do something similar just yesterday. I wrote

RE: Fixtures

2007-02-13 Thread Ovid
--- Kirrily Robert <[EMAIL PROTECTED]> wrote: > 2. Assume a directory t/data (or t/fixtures if you will -- I just > call > it data in my own tests). > 3. Create a file t/data/foo.yml (or whatever data format) containing > the > data needed by the tests in foo.t > 4. At t

RE: Fixtures

2007-02-13 Thread leif . eriksen
Ruby has a nice description at http://manuals.rubyonrails.com/read/chapter/26 To quote "Fixtures is a fancy word for ‘sample data’. Fixtures allow you to populate your testing database with predefined data before your tests run." Think about how something like Test::MockDBI's

RE: Fixtures

2007-02-13 Thread Kirrily Robert
est::More style example: 1. Assume a test file t/foo.t 2. Assume a directory t/data (or t/fixtures if you will -- I just call it data in my own tests). 3. Create a file t/data/foo.yml (or whatever data format) containing the data needed by the tests in foo.t 4. At the beginning of foo.t, load da

Re: Fixtures

2007-02-13 Thread Ian Langworth
On 2/12/07, Kirrily Robert <[EMAIL PROTECTED]> wrote: Does anyone here understand "fixtures" as a testing concept, and could they please explain it to me in a Perlish way? In terms of etymology only, it was explained to me that the term "fixture" comes from th

Re: Fixtures

2007-02-13 Thread Eric Wilhelm
# from Ovid # on Tuesday 13 February 2007 01:16 am: >--- Kirrily Robert <[EMAIL PROTECTED]> wrote: >> Does anyone here understand "fixtures" as a testing concept, and >> could they please explain it to me in a Perlish way? >> >> At least half of what I&#

Re: Fixtures

2007-02-13 Thread Michael G Schwern
[EMAIL PROTECTED] wrote: > On Tue, Feb 13, 2007 at 09:20:29AM -0800, chromatic wrote: >> On Tuesday 13 February 2007 08:24, Ovid wrote: >> >>> Really? :) >>> >>> java.lang.NullPointerException >> Oh please, everyone knows Java doesn't have pointers! > > Of course it does. They may not be accessibl

Re: Fixtures

2007-02-13 Thread ben
On Tue, Feb 13, 2007 at 09:20:29AM -0800, chromatic wrote: >On Tuesday 13 February 2007 08:24, Ovid wrote: > >> Really? :) >> >> java.lang.NullPointerException > >Oh please, everyone knows Java doesn't have pointers! Of course it does. They may not be accessible to the programmer due to the desig

Re: Fixtures

2007-02-13 Thread chromatic
On Tuesday 13 February 2007 08:24, Ovid wrote: > Really? :) > > java.lang.NullPointerException Oh please, everyone knows Java doesn't have pointers! -- c OT - there are a lot of definitions of fixtures. The best I've found is "stuff tests share", which is exactly what Skud said.

Re: Fixtures

2007-02-13 Thread Ovid
--- Matisse Enzer <[EMAIL PROTECTED]> wrote: > Typically the programmers provide a "Fixture" for each category of > testing and the non-programers edit a wiki page to add rows to a > table. Each row in the table on the wiki page is interpreted as a > assertion and when you click the "test" b

Re: Fixtures

2007-02-13 Thread Matisse Enzer
On Feb 12, 2007, at 10:35 PM, Kirrily Robert wrote: Does anyone here understand "fixtures" as a testing concept, and could they please explain it to me in a Perlish way? One definition of a "fixture" comes from the Fitnesse system which is a framework for collabo

Re: Fixtures

2007-02-13 Thread Ovid
--- Kirrily Robert <[EMAIL PROTECTED]> wrote: > Does anyone here understand "fixtures" as a testing concept, and could > they please explain it to me in a Perlish way? > > At least half of what I've heard described is what I usually achieve > with a t/

Fixtures

2007-02-12 Thread Kirrily Robert
Does anyone here understand "fixtures" as a testing concept, and could they please explain it to me in a Perlish way? At least half of what I've heard described is what I usually achieve with a t/data/ directory, and another half is what I'd do by writing a specialized