The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Something surprising about SUnit

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Something surprising about SUnit Posted: Jan 27, 2005 9:42 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Something surprising about SUnit
Feed Title: Richard Demers Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rademers-rss.xml
Feed Description: Richard Demers on Smalltalk
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Richard Demers Blog

Advertisement

I just learned something surprising about VisualWorks SUnit. If test cases are created in an inheritance hierarchy, lower level test cases inherit "test*" methods from their superclass.

Well yes, that's what inheritance means.

Right, but it never occurred to me that selecting a subclass test case and clicking the RUN button would also RUN the test methods of the superclass test cases.

I am of two minds about this.

On one hand, it is a convenience. Let's assume that test cases are set up in a hierarchy that is parallel to the classes being tested. Then, theoretically, every superclass test needs to be run where an instance of the subclass is the subject of testing; that is, when the subclass test case is run. If only the tests defined by the subclass test case were run, testing would be incomplete, unless tests of the form

testX
     super testX          
were added to the subclass test case to force running of superclass test methods.

On the other hand, there is nothing saying test cases have to be set up in a parallel hierarchy. In fact, it is a somewhat unnatural thing to do, since test cases are already part of a testing hierarchy. Of course, hierarchies can have multiple purposes, but is that good design? Usually not.

I guess this is a fait accompli that must simply be accepted, but I can't say I liked being surprised. I am probably a bit hard-nosed about such things, but I believe it is a design error to impose a new, unexpected, function on an existing, well-understood mechanism. I really had no reason to think the superclass test methods would be run. There's nothing about it in the VW documentation.

I'd be interested in learning any further rationale for this situation.

Read: Something surprising about SUnit

Topic: Food for Tech Marketers? Previous Topic   Next Topic Topic: Are Unit Tests Always Useful?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use