[Rt-devel] [TESTS][BUG] Wrote some API tests

Jesse Vincent jesse at bestpractical.com
Fri Dec 10 13:49:05 EST 2004


> So _please_ show me how my test file can be rewriten to be independant 
> from other tests/DB data and check all the cases that it checks now.

The only assumption you were making that was harmful was that there
would be no global custom fields. So all I did was add a couple lines to
ensure thatif they're there, they get deleted.


> It's the pain to write tests and take on mind that DB can contain any 
> data. It would be pain to track why your new tests break some tests in 
> other files that runs after yours. Contributor can not even know how 
> tests in that files works.
> 
> Are you shure that you can always write tests that would be absolutely 
> independant from data in DB. I have great confidence that I can't write 
> some tests if I'm not sure that DB in some well known state.
>

I've not found it at all hard to test my assumptions about the database
state before running my tests as I write a test script.  
> 
> May be I don't know something, but I don't know how to run this or that 
> test file in current RT test suit. Next command I was using to run my 
> test file after each edition:
> ./configure --with-web-user=apache --with-web-group=apache 
> --with-devel-mode; sudo sh reinitdb_silent.sh; sudo perl 
> lib/t/09record_customfields.t
> Is it normal for test case?
> 
> Next is normal:
> make test TEST_FILES=lib/t/09record_customfields.t

Yes. And I'd love to get there. RT uses autoconf, not MakeMaker, so we
don't have all the makemaker magic at our fingertips. We spoke on IRC about 
dding the support code to handle test files droppted into
lib/t/regression. I'd be thrilled if this could support cpan style tests
that can more easily stand alone.

> If you help us write test cases easier in any way then at least I spend 
> more time to add more tests to RT API.


Thanks. It is much appreciated and I do want to make it happen. Once 3.4
gets out the door, I'd love to do work on this for the next release.  I
suppose I could create a PLATANO (experimental) branch for testsuite
work.

	Jesse



More information about the Rt-devel mailing list