[Cuis-dev] TestCase superclass
Benoit St-Jean
bstjean at yahoo.com
Tue Nov 19 19:34:55 PST 2024
Make sure #shouldInheritSelectors is a **class** method.
And define it in the class(es) you want to inherit from, NOT in the
superclass!
On 2024-11-18 22:01, Mark Volkmann via Cuis-dev wrote:
> I'm implementing a database ORM and want to test it against three
> databases, SQLite, Postgres, and MySQL. I created a subclass of
> TestCase that defines all the test methods. They rely on setting two
> instance variables that identify the database to use. Then I created
> three subclasses of that class, one for each database type. I can
> select those three classes and run all the tests in "SUnit Test
> Runner". Works great!
>
> Here's my class hierarchy:
>
> TestCase
> DatabaseAbstractTests
> MySQLTests
> PostgresTests
> SQLiteTests
>
> But then I added a database specific test in each of those subclasses
> and that broke things. Now when I run those three test classes, they
> each only run the test method defined directly in them and not the
> test methods they inherit.
>
> In my web search I found that this is the expected behavior. But I
> also read that if I add the method isAbstract in DatabaseAbstractTests
> to return true AND I define the method shouldInheritSelectors in those
> subclasses then it will also run the inherited test methods. I did
> this, but it isn't working. Any suggestions for what I might be doing
> wrong?
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20241119/7b8acb0a/attachment.htm>
More information about the Cuis-dev
mailing list