[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gzz] Jython tests
From: |
Tuomas Lukka |
Subject: |
Re: [Gzz] Jython tests |
Date: |
Sat, 18 May 2002 21:54:40 +0300 |
User-agent: |
Mutt/1.3.25i |
On Sat, May 18, 2002 at 06:01:13PM +0200, B. Fallenstein wrote:
> Tuomas Lukka wrote:
> >I think I'd prefer just making test scripts like Perl's... They're
> >a good example of how to make tests simple using character streams.
>
> Test scripts are what I'd like: creating a new test should be as simple
> as creating a new file and putting a few statements in it.
Agreed.
> >Each test prints out lines of the form
> >
> >13
> >ok 5
> >not ok 6
> >
> >where the first number is the number of test cases to expect, then the
> >next numbers are in a sequence. All other output is ignored (can be used
> >for debugging).
>
> This, on the other hand, does not sound very useful to me. I certainly
> don't want to write 'print "ok 5"' statements in my source code-- and
> change them every time I add a new test case in the middle or something.
Yes, that's a problem. On the other hand, it's a really simple approach.
> (Forgive my use of Ly-ish metasyntax.) In this scheme, the test engine
> would load the module and extract the tests by reflection (easy in
> Python). Then it would call tearDown(), re-load the module for every
> test, run the test and tearDown() again.
Yes, that could work.
> The point is that we'd be using the module namespace for the test
> fixture variables, meaning each test function would have instant access
> to them; and by not placing the setUp() code in a method, we'd avoid
> having to declare the variables in there as 'global'.
>
> In fact, I think we could create a wrapper that encapsulates these as a
> PyUnit class...
Sounds very good.
Tuomas