Hi everybody:
I am having a problem with Sunit on Squeak. I have a class called A and has a testXXX method (method that should be executed by sunit). I have class B that inherits from A and has no test method (method that should be run by sunit). When I want to run the tests of B (from Test Runner) I notice that testXXX is not run. I mean, zero runs for class B. I think this is incorrect. Am I ok ? Should testXXX be executed in this case ? Thanks for the help. Mariano |
SUnit will only use inherited test selectors if the superclass is
declared as abstract. I find this horribly annoying but that's the way it is. You'll have to implement something like: SuperTest class>>isAbstract ^self == SuperTest "NOT ^true since this makes subclasses abstract too" See ToolBuilderTests and its subclasses for an example. Cheers, - Andreas Mariano Martinez Peck wrote: > Hi everybody: > > I am having a problem with Sunit on Squeak. I have a class called A and > has a testXXX method (method that should be executed by sunit). I have > class B that inherits from A and has no test method (method that should > be run by sunit). When I want to run the tests of B (from Test Runner) I > notice that testXXX is not run. I mean, zero runs for class B. I think > this is incorrect. Am I ok ? Should testXXX be executed in this case ? > > Thanks for the help. > > Mariano > > > ------------------------------------------------------------------------ > > |
On Thu, Mar 26, 2009 at 1:22 AM, Andreas Raab <[hidden email]> wrote: SUnit will only use inherited test selectors if the superclass is declared as abstract. I find this horribly annoying but that's the way it is. You'll have to implement something like: It doesn't work :( I tried it with my class and also with MVCToolBuilderTests. In both cases I get this wallback: any ideas? thanks for the help. mariano MessageNotUnderstood: DBXMainBackendTestPostgresql class>>allSelectorsBelow: 26 March 2009 1:28:40 am VM: unix - a SmalltalkImage Image: Squeak3.10.2 [latest update: #7179] SecurityManager state: Restricted: false FileAccess: true SocketAccess: true Working Dir /home/mariano/squeak/imagenes Trusted Dir /home/mariano/squeak/imagenes/secure Untrusted Dir /home/mariano/squeak/imagenes/My Squeak DBXMainBackendTestPostgresql class(Object)>>doesNotUnderstand: #allSelectorsBelow: Receiver: DBXMainBackendTestPostgresql Arguments and temporary variables: aMessage: allSelectorsBelow: TestCase Receiver's instance variables: superclass: DBXMainBackendTest methodDict: a MethodDictionary(#facilityToTest->a CompiledMethod (1970) ) format: 132 instanceVariables: nil organization: ('facility' facilityToTest) subclasses: nil name: #DBXMainBackendTestPostgresql classPool: nil sharedPools: nil environment: a SystemDictionary(lots of globals) category: #'OpenDBX-Core-Tests' traitComposition: nil localSelectors: nil DBXMainBackendTestPostgresql class(TestCase class)>>withInheritedSelectors Receiver: DBXMainBackendTestPostgresql Arguments and temporary variables: Receiver's instance variables: superclass: DBXMainBackendTest methodDict: a MethodDictionary(#facilityToTest->a CompiledMethod (1970) ) format: 132 instanceVariables: nil organization: ('facility' facilityToTest) subclasses: nil name: #DBXMainBackendTestPostgresql classPool: nil sharedPools: nil environment: a SystemDictionary(lots of globals) category: #'OpenDBX-Core-Tests' traitComposition: nil localSelectors: nil DBXMainBackendTestPostgresql class(TestCase class)>>testsSelect: Receiver: DBXMainBackendTestPostgresql Arguments and temporary variables: aBlock: [] in DBXMainBackendTestPostgresql class(TestCase class)>>suiteWithSele...etc... selector: nil s: nil Receiver's instance variables: superclass: DBXMainBackendTest methodDict: a MethodDictionary(#facilityToTest->a CompiledMethod (1970) ) format: 132 instanceVariables: nil organization: ('facility' facilityToTest) subclasses: nil name: #DBXMainBackendTestPostgresql classPool: nil sharedPools: nil environment: a SystemDictionary(lots of globals) category: #'OpenDBX-Core-Tests' traitComposition: nil localSelectors: nil [] in DBXMainBackendTestPostgresql class(TestCase class)>>suiteWithSelectorsMatching: {[:testClass | suite addTests: (testClass testsSelect: [:sel | pattern ...]} Arguments and temporary variables: pattern: 'test*' suite: a TestSuite testClass: DBXMainBackendTestPostgresql sel: nil --- The full stack --- DBXMainBackendTestPostgresql class(Object)>>doesNotUnderstand: #allSelectorsBelow: DBXMainBackendTestPostgresql class(TestCase class)>>withInheritedSelectors DBXMainBackendTestPostgresql class(TestCase class)>>testsSelect: [] in DBXMainBackendTestPostgresql class(TestCase class)>>suiteWithSelectorsMatching: {[:testClass | suite addTests: (testClass testsSelect: [:sel | pattern ...]} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Array(SequenceableCollection)>>do: [] in DBXMainBackendTestPostgresql class(TestCase class)>>suiteWithSelectorsMatching: {[:suite | self theClasses do: [:testClass | suite addTests: (testClass...]} TestSuite(Object)>>in: TestSuite class>>define: DBXMainBackendTestPostgresql class(TestCase class)>>suiteWithSelectorsMatching: DBXMainBackendTestPostgresql class(TestCase class)>>allStandardTests DBXMainBackendTestPostgresql class(TestCase class)>>suite: [] in TestSuite>>fromClasses:suites:select:reject: {[:suite | self addTests: (testClass suite: suite) tests]} Set>>do: [] in TestSuite>>fromClasses:suites:select:reject: {[:testClass | suites do: [:suite | self addTests: (testClass suite: suite...]} Set>>do: TestSuite>>fromClasses:suites:select:reject: TestSuite class>>classes:suites:select:reject: TestRunner>>suiteAll TestRunner>>runAll PluggableButtonMorphPlus(PluggableButtonMorph)>>performAction PluggableButtonMorphPlus>>performAction [] in PluggableButtonMorphPlus(PluggableButtonMorph)>>mouseUp: {[:m | (m containsPoint: evt cursorPoint) ifTrue: [m performAction]]} Array(SequenceableCollection)>>do: PluggableButtonMorphPlus(PluggableButtonMorph)>>mouseUp: PluggableButtonMorphPlus>>mouseUp: ...etc...
|
Mariano Martinez Peck wrote:
> On Thu, Mar 26, 2009 at 1:22 AM, Andreas Raab <[hidden email] > <mailto:[hidden email]>> wrote: > > SUnit will only use inherited test selectors if the superclass is > declared as abstract. I find this horribly annoying but that's the > way it is. You'll have to implement something like: > > SuperTest class>>isAbstract > ^self == SuperTest "NOT ^true since this makes subclasses > abstract too" > > See ToolBuilderTests and its subclasses for an example. > > > It doesn't work :( I tried it with my class and also with > MVCToolBuilderTests. In both cases I get this wallback: > > any ideas? Well, that's because you have some non-standard patches to SUnit loaded. If you use a straight 3.10.2 image it doesn't even include methods like #allSelectorsBelow: or #withInheritedSelectors that show up in your call stack. I suggest you don't just load every random "enhancement" you find on the net in particular when it comes to something as fundamental as SUnit ;-) Cheers, - Andreas |
Andreas Raab wrote:
> Mariano Martinez Peck wrote: >> On Thu, Mar 26, 2009 at 1:22 AM, Andreas Raab <[hidden email] >> <mailto:[hidden email]>> wrote: >> >> SUnit will only use inherited test selectors if the superclass is >> declared as abstract. I find this horribly annoying but that's the >> way it is. You'll have to implement something like: >> >> SuperTest class>>isAbstract >> ^self == SuperTest "NOT ^true since this makes subclasses >> abstract too" >> >> See ToolBuilderTests and its subclasses for an example. >> >> >> It doesn't work :( I tried it with my class and also with >> MVCToolBuilderTests. In both cases I get this wallback: >> >> any ideas? > > Well, that's because you have some non-standard patches to SUnit > loaded. If you use a straight 3.10.2 image it doesn't even include > methods like #allSelectorsBelow: or #withInheritedSelectors that show > up in your call stack. > > I suggest you don't just load every random "enhancement" you find on > the net in particular when it comes to something as fundamental as > SUnit ;-) > > Cheers, > - Andreas #shouldInheritSelectors has to be explicitly set, rather than guessed at. Keith |
In reply to this post by Andreas.Raab
Andreas Raab wrote:
> Mariano Martinez Peck wrote: >> On Thu, Mar 26, 2009 at 1:22 AM, Andreas Raab <[hidden email] >> <mailto:[hidden email]>> wrote: >> >> SUnit will only use inherited test selectors if the superclass is >> declared as abstract. I find this horribly annoying but that's the >> way it is. You'll have to implement something like: >> >> SuperTest class>>isAbstract >> ^self == SuperTest "NOT ^true since this makes subclasses >> abstract too" >> >> See ToolBuilderTests and its subclasses for an example. >> >> >> It doesn't work :( I tried it with my class and also with >> MVCToolBuilderTests. In both cases I get this wallback: >> >> any ideas? > > Well, that's because you have some non-standard patches to SUnit > loaded. If you use a straight 3.10.2 image it doesn't even include > methods like #allSelectorsBelow: or #withInheritedSelectors that show > up in your call stack. > > I suggest you don't just load every random "enhancement" you find on > the net in particular when it comes to something as fundamental as > SUnit ;-) > > Cheers, > - Andreas a) no way to categorise tests to indicate what should work where. b) we have no way to time or know if tests use the network c) we have no way to integrate other testing frameworks ie. SSpec into the existing GUI etc etc. d) you cant define an exception handler around your tests to collect notifications. etc etc. All that has changed in this instance is that #shouldInheritSelectors must be defined explicitly for your class, which is better I think, it doesn't depend upon who my superclass happens to be. I can remember having issues with this going back 10 years. As far as I know this is the only change to the existing api. Keith |
Keith Hodges wrote:
> I wrote SUnit-improved because if we dont move it forward we have I've got no problems with your enhancements. I was trying to caution Mariano to apply a level of judgement before loading random bits off the net. But since you seem to know the code, how about you help him fix his problem? My motto is: If you break it, you fix it :-) Cheers, - Andreas > a) no way to categorise tests to indicate what should work where. > b) we have no way to time or know if tests use the network > c) we have no way to integrate other testing frameworks ie. SSpec into > the existing GUI etc etc. > d) you cant define an exception handler around your tests to collect > notifications. > > etc etc. > > All that has changed in this instance is that #shouldInheritSelectors > must be defined explicitly for your class, which is better I think, it > doesn't depend upon who my superclass happens to be. I can remember > having issues with this going back 10 years. > > As far as I know this is the only change to the existing api. > > Keith > > > > > |
In reply to this post by keith1y
On Thu, Mar 26, 2009 at 7:16 AM, Keith Hodges <[hidden email]> wrote:
Ok. Thanks. I wasn't aware of that. I look at it, I add a class side method in my super test class like this: shouldInheritSelectors ^ true but still doesn't work and I am having the same error. What I am doing wrong ? thanks in advance mariano
|
> On Thu, Mar 26, 2009 at 7:16 AM, Keith Hodges > <[hidden email] <mailto:[hidden email]>> wrote: > > > Ok. Thanks. I wasn't aware of that. I look at it, I add a class side > method in my super test class like this: > > shouldInheritSelectors > ^ true > > but still doesn't work and I am having the same error. What I am doing > wrong ? > > thanks in advance > > mariano need this fix: Installer mantis ensureFix: 7166. Keith |
Keith Hodges wrote:
>> On Thu, Mar 26, 2009 at 7:16 AM, Keith Hodges >> <[hidden email] <mailto:[hidden email]>> wrote: >> >> >> Ok. Thanks. I wasn't aware of that. I look at it, I add a class side >> method in my super test class like this: >> >> shouldInheritSelectors >> ^ true >> >> but still doesn't work and I am having the same error. What I am doing >> wrong ? >> >> thanks in advance >> >> mariano >> > Now its my turn to apologize, I should have seen this immediately. You > need this fix: > > Installer mantis ensureFix: 7166. > > Keith > Keith |
On Fri, Mar 27, 2009 at 8:43 AM, Keith Hodges <[hidden email]> wrote:
Ok. Now it works :) Thanks a lot. Mariano
|
Free forum by Nabble | Edit this page |