> Good Solution:
> I still don't see one.
> I guess that it would be possible to sublcass TableRowContainerTest for each
> instance of the meta data that I would otherwise construct an instance
> around.
> But this is a lot of extra classes for no reason other than to get around a
> limitation in JUnit.
> I could also have a static variable that I repeatedly update to the new meta
> data, and then run the tests. But this could get into some tricky threading
> issues. But again I am not sure how I would update the variable and run the
> tests, and get the TestResults to come out appropriately.
You're right; you don't want to do this.
> Is it so wrong to want to instantiate a test with some parameters and
> automatically run the tests on it?
No, but JUnit was not designed that way.
> Of course I am new to Unit Testing. It was trivially easy
> until I came across this problem. Now it feels like I am fighting with
> JUnit,
> Parameterized TestCase is close, but I
> don't want to override runTest(). I want the reflective base
> functionality to
> run all methods named test* automatically, and for the results to show up
> appropriately.
This is a different problem from the one you described before, so it's a
different one from what I tried to help you solve.
I have implemented Parameterized Test Suite, which is a hybrid of
Parameterized Test Case and the automatic test*() method extractor. I
didn't like the solution. I would recommend using FitNesse for this kind
of test, rather than JUnit. Don't be thrown off by the fact that
FitNesse is an "acceptance testing" tool. It's great for data driven
tests like the one you're trying to write.
--
J. B. (Joe) Rainsberger
Diaspar Software Services
http://www.diasparsoftware.com
Author, JUnit Recipes: Practical Methods for Programmer Testing
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/junit/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
