TestRunner to run superclass's tests

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

TestRunner to run superclass's tests

Pierce Ng-3
Hi all,

I have a testing class that is sub-subclass of TestCase, i.e., the class
hierarchy looks like this:

  TestCase
    ExistingTestingClass
      MyNewTestingClass

How do I get TestRunner to run MyNewTestingClass's tests, as well as
ExistingTestingClass's tests in the context of MyNewTestingClass?

Pierce

Reply | Threaded
Open this post in threaded view
|

Re: TestRunner to run superclass's tests

Tim Mackinnon
Hi Pierce - not sure I understand what you are trying to do - I tend to run all tests in a package which it cmd-t in calypso, but I sometimes need to run lots of disjoint tests, so I created a fake test and overrode the suite method eg:

TestCase subclass: #AllExercismTests
        instanceVariableNames: ''
        classVariableNames: ''
        package: ‘ExercismSystemTests'


suite
        ^ self allExercismTests
                inject: TestSuite new
                into: [ :suite :test | suite addTest: test buildSuiteFromSelectors ]

To get the tests I use this helper method - but do whatever you need if its not package based (thinking to myself, I could modify this to get my tests from the baseline)

allExercismTestsFor: packagesNameList
        "gather all the TestCases in the Execercsim package"

        ^ packagesNameList
                inject: Set new
                into: [ :finalResult :pkgName |
                        (RPackageOrganizer default packageNamed: pkgName) packages
                                inject: finalResult
                                into: [ :result :pkg |
                                        result
                                                addAll: (pkg classes select: [ :c | c isTestCase ]);
                                                yourself ] ]


And then have a fake test so you can click the green orb:

testAll
        "Create a suite to eaily run all the tests - this is a stub that gives a browser button
        to easily click on to run all the composite tests"
       
        ^true
       

> On 23 May 2019, at 11:16, Pierce Ng <[hidden email]> wrote:
>
> Hi all,
>
> I have a testing class that is sub-subclass of TestCase, i.e., the class
> hierarchy looks like this:
>
>  TestCase
>    ExistingTestingClass
>      MyNewTestingClass
>
> How do I get TestRunner to run MyNewTestingClass's tests, as well as
> ExistingTestingClass's tests in the context of MyNewTestingClass?
>
> Pierce
>


Reply | Threaded
Open this post in threaded view
|

Re: TestRunner to run superclass's tests

CyrilFerlicot
In reply to this post by Pierce Ng-3
On Thu, May 23, 2019 at 12:17 PM Pierce Ng <[hidden email]> wrote:

>
> Hi all,
>
> I have a testing class that is sub-subclass of TestCase, i.e., the class
> hierarchy looks like this:
>
>   TestCase
>     ExistingTestingClass
>       MyNewTestingClass
>
> How do I get TestRunner to run MyNewTestingClass's tests, as well as
> ExistingTestingClass's tests in the context of MyNewTestingClass?
>

Hi,

Currently, to inherit tests you need to override
#shouldInheritSelectors to return true.

> Pierce
>


--
Cyril Ferlicot
https://ferlicot.fr

Reply | Threaded
Open this post in threaded view
|

Re: TestRunner to run superclass's tests

Tim Mackinnon
Oh yeah - I forgot about that one too… and another developer wastes time on that strange decision (we really must get it changed, its just not what you expect)

> On 23 May 2019, at 13:14, Cyril Ferlicot <[hidden email]> wrote:
>
>
> Currently, to inherit tests you need to override
> #shouldInheritSelectors to return true.
>
>> Pierce
>>
>
>
> --
> Cyril Ferlicot
> https://ferlicot.fr
>


Reply | Threaded
Open this post in threaded view
|

Re: TestRunner to run superclass's tests

Pierce Ng-3
In reply to this post by CyrilFerlicot
On Thu, May 23, 2019 at 02:14:08PM +0200, Cyril Ferlicot wrote:
> Currently, to inherit tests you need to override
> #shouldInheritSelectors to return true.

Thank you Cyril.