[vwnc] code coverage tool (using SUnittoo)

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

[vwnc] code coverage tool (using SUnittoo)

Mathieu van Echtelt-3
Hi all,

I'm trying to get the code coverage tool running, but can't figure out
how to get/see coverage results of methods in package x after running
testcase y?

What I did:

First I loaded:

SUnitToo
SUnitToo(ls)
SUnitToo(verage)
SUnitToo(lsverage)

Than I changed the superclass of my Testcase class to SUnit.TestCase
and my TestResource class to SUnit.TestResource, so my testcases run
under SunitToo instead of classical Sunit.

This all works fine, all my tests run green.

After that I've run the testcases of class CoverageTestCase in Package
SunitToo(verage), all are green (4).

I can find the "eraser button" which is mentioned in:
http://www.cincomsmalltalk.com/userblogs/mls/blogView?search=code%20coverage&searchTitle=true&searchText=true.

So far so good.

What am I missing?

note:  I remember a picture of the coverage browser having extra icons
for the SelectorNavigatorPart in the RB Browser. I don't see them now,
but package SunitToo(lsoverage) includes overrides for class
SelectorNavigatorPart e.g. displayTextFor: (percentage calculation),
so I suspect something went wrong here.


thanks in advance,

Mathieu van Echtelt
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

Michael Lucas-Smith-2
Which version of VW are you using?

Mathieu van Echtelt wrote:

> Hi all,
>
> I'm trying to get the code coverage tool running, but can't figure out
> how to get/see coverage results of methods in package x after running
> testcase y?
>
> What I did:
>
> First I loaded:
>
> SUnitToo
> SUnitToo(ls)
> SUnitToo(verage)
> SUnitToo(lsverage)
>
> Than I changed the superclass of my Testcase class to SUnit.TestCase
> and my TestResource class to SUnit.TestResource, so my testcases run
> under SunitToo instead of classical Sunit.
>
> This all works fine, all my tests run green.
>
> After that I've run the testcases of class CoverageTestCase in Package
> SunitToo(verage), all are green (4).
>
> I can find the "eraser button" which is mentioned in:
> http://www.cincomsmalltalk.com/userblogs/mls/blogView?search=code%20coverage&searchTitle=true&searchText=true.
>
> So far so good.
>
> What am I missing?
>
> note:  I remember a picture of the coverage browser having extra icons
> for the SelectorNavigatorPart in the RB Browser. I don't see them now,
> but package SunitToo(lsoverage) includes overrides for class
> SelectorNavigatorPart e.g. displayTextFor: (percentage calculation),
> so I suspect something went wrong here.
>
>
> thanks in advance,
>
> Mathieu van Echtelt
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>  

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

Mathieu van Echtelt-2
vw 7.6



On Mon, Dec 1, 2008 at 7:28 PM, Michael Lucas-Smith
<[hidden email]> wrote:

> Which version of VW are you using?
>
> Mathieu van Echtelt wrote:
>>
>> Hi all,
>>
>> I'm trying to get the code coverage tool running, but can't figure out
>> how to get/see coverage results of methods in package x after running
>> testcase y?
>>
>> What I did:
>>
>> First I loaded:
>>
>> SUnitToo
>> SUnitToo(ls)
>> SUnitToo(verage)
>> SUnitToo(lsverage)
>>
>> Than I changed the superclass of my Testcase class to SUnit.TestCase
>> and my TestResource class to SUnit.TestResource, so my testcases run
>> under SunitToo instead of classical Sunit.
>>
>> This all works fine, all my tests run green.
>>
>> After that I've run the testcases of class CoverageTestCase in Package
>> SunitToo(verage), all are green (4).
>>
>> I can find the "eraser button" which is mentioned in:
>>
>> http://www.cincomsmalltalk.com/userblogs/mls/blogView?search=code%20coverage&searchTitle=true&searchText=true.
>>
>> So far so good.
>>
>> What am I missing?
>>
>> note:  I remember a picture of the coverage browser having extra icons
>> for the SelectorNavigatorPart in the RB Browser. I don't see them now,
>> but package SunitToo(lsoverage) includes overrides for class
>> SelectorNavigatorPart e.g. displayTextFor: (percentage calculation),
>> so I suspect something went wrong here.
>>
>>
>> thanks in advance,
>>
>> Mathieu van Echtelt
>> _______________________________________________
>> vwnc mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>>
>>
>
>



--
AG5 - Product manager
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

Michael Lucas-Smith-2
I've put it on my todo list to take a look.

Cheers,
Michael

Mathieu van Echtelt wrote:

> vw 7.6
>
>
>
> On Mon, Dec 1, 2008 at 7:28 PM, Michael Lucas-Smith
> <[hidden email]> wrote:
>  
>> Which version of VW are you using?
>>
>> Mathieu van Echtelt wrote:
>>    
>>> Hi all,
>>>
>>> I'm trying to get the code coverage tool running, but can't figure out
>>> how to get/see coverage results of methods in package x after running
>>> testcase y?
>>>
>>> What I did:
>>>
>>> First I loaded:
>>>
>>> SUnitToo
>>> SUnitToo(ls)
>>> SUnitToo(verage)
>>> SUnitToo(lsverage)
>>>
>>> Than I changed the superclass of my Testcase class to SUnit.TestCase
>>> and my TestResource class to SUnit.TestResource, so my testcases run
>>> under SunitToo instead of classical Sunit.
>>>
>>> This all works fine, all my tests run green.
>>>
>>> After that I've run the testcases of class CoverageTestCase in Package
>>> SunitToo(verage), all are green (4).
>>>
>>> I can find the "eraser button" which is mentioned in:
>>>
>>> http://www.cincomsmalltalk.com/userblogs/mls/blogView?search=code%20coverage&searchTitle=true&searchText=true.
>>>
>>> So far so good.
>>>
>>> What am I missing?
>>>
>>> note:  I remember a picture of the coverage browser having extra icons
>>> for the SelectorNavigatorPart in the RB Browser. I don't see them now,
>>> but package SunitToo(lsoverage) includes overrides for class
>>> SelectorNavigatorPart e.g. displayTextFor: (percentage calculation),
>>> so I suspect something went wrong here.
>>>
>>>
>>> thanks in advance,
>>>
>>> Mathieu van Echtelt
>>> _______________________________________________
>>> vwnc mailing list
>>> [hidden email]
>>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>>>
>>>
>>>      
>>    
>
>
>
>  

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

David Lattimore
In reply to this post by Mathieu van Echtelt-3
You could try having a look at the package "BranchCoverage" that I just
published to public store.  It's based on SUnitToo(verage) but removes
prerequisites on SUnitToo, fixes things up for VW7.6 and changes from a
viral mechanism of instrumenting methods (cool though it was) to an
instrument-this-package method.  It doesn't as yet have a neat way to
instrument code through the RB (would be nice to perhaps right click on
a package and select enable coverage), but running a line of code to
enable coverage isn't too onerous.

David

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

thomas.hawker
It shouldn't be too hard to tie this into the RB - just add a method to an extension of BrowserNavigator with a menu pragma, inserting your menu item into the pundle menu, like this:

sunitEnableBranchCoverage
        <menuItem: #(#EnableCoverage #browser 'Enable Coverage')
                nameKey: #storeFileOutDatabasePundleAs
                enablement: #isPundleSelected
                indication: nil
                menu: #(#pundleMenu)
                position: 35.1>

        self packages do: [:each | each enableCoverage]

Adjust the position value so the menu item appears where you like.  You can have more symbols in #(#pundleMenu) to place this in a submenu.

Cheers!
 
Tom Hawker
--------------------------
Senior Framework Developer
--------------------------
Home +1 (408) 274-4128
Office +1 (408) 576-6591
Mobile +1 (408) 835-3643
 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of David Price
Sent: Tuesday, December 02, 2008 1:20 PM
To: Mathieu van Echtelt
Cc: VWNC
Subject: Re: [vwnc] code coverage tool (using SUnittoo)

You could try having a look at the package "BranchCoverage" that I just
published to public store.  It's based on SUnitToo(verage) but removes
prerequisites on SUnitToo, fixes things up for VW7.6 and changes from a
viral mechanism of instrumenting methods (cool though it was) to an
instrument-this-package method.  It doesn't as yet have a neat way to
instrument code through the RB (would be nice to perhaps right click on
a package and select enable coverage), but running a line of code to
enable coverage isn't too onerous.

David

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged.  If it is not intended for you, please delete it immediately unread.  The internet cannot guarantee that this communication is free of viruses, interception or interference and anyone who communicates with us by email is taken to accept the risks in doing so.  Without limitation, OOCL and its affiliates accept no liability whatsoever and howsoever arising in connection with the use of this email.  Under no circumstances shall this email constitute a binding agreement to carry or for provision of carriage services by OOCL, which is subject to the availability of carrier's equipment and vessels and the terms and conditions of OOCL's standard bill of lading which is also available at http://www.oocl.com.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

Michael Lucas-Smith-2
In reply to this post by David Lattimore
Even better! Thanks Dave.

David Price wrote:

> You could try having a look at the package "BranchCoverage" that I just
> published to public store.  It's based on SUnitToo(verage) but removes
> prerequisites on SUnitToo, fixes things up for VW7.6 and changes from a
> viral mechanism of instrumenting methods (cool though it was) to an
> instrument-this-package method.  It doesn't as yet have a neat way to
> instrument code through the RB (would be nice to perhaps right click on
> a package and select enable coverage), but running a line of code to
> enable coverage isn't too onerous.
>
> David
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>  

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

Travis Griggs-3
In reply to this post by thomas.hawker

On Dec 2, 2008, at 1:39 PM, <[hidden email]> <[hidden email]
 > wrote:

> It shouldn't be too hard to tie this into the RB - just add a method  
> to an extension of BrowserNavigator with a menu pragma, inserting  
> your menu item into the pundle menu, like this:
>
> sunitEnableBranchCoverage
> <menuItem: #(#EnableCoverage #browser 'Enable Coverage')
> nameKey: #storeFileOutDatabasePundleAs
> enablement: #isPundleSelected
> indication: nil
> menu: #(#pundleMenu)
> position: 35.1>
>
> self packages do: [:each | each enableCoverage]
>

Better yet, use

sunitEnableBranchCoverage

        <itemInMenu: #(#pundleMenu) position: 35.1>

        ^(MenuItem labeled: #EnableCoverage << #IDE >> 'Enable Coverage')
                value: [self pacakges do: #enableCoverage];
                enablement: #isPundleSelected;
                yourself

Real objects with real messages even. :)

--
Travis Griggs
Objologist
My Other Machine runs OSX. But then... so does this one.



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

Mathieu van Echtelt-2
In reply to this post by David Lattimore
Hi David,


First of all Thanks! (but don't stop reading, still some questions left)

What you write sounds exactly what I need,  (also making it
independent form sunittoo).

About making it independent from sunittoo there were some issues remaining:

- I had to change superclass of CoverageTestCase to
XProgramming.Sunit.TestCase instead of Sunittoo's TestCase .
- in MethodCoverage>>calculateCoveragesForClass: aClass inPundle:
aPundle, the isTestCase is from Sunittoo package.
- Removed Sunittoo as prerequisite from BrancheCoverage Package.

Question: when you wrote: "It's based on SUnitToo(verage)" you mean
it's inspired by, but I do not need to load SUnitToo(verage), right?

Then I run the testcases of CoverageTestCase. They are all green.

Then I executed:

BranchCoverage.CoverageWrapper installOnPundleNamed: 'My package'

Run some of my tests which should touch methods inside   'My package'.

However, I still do not see coverage results!

So unfortunately, my question remains: where/how should I see them, in
the RB Browser?

btw. After running the tests, I inspected dictionary
"BranchCoverage.Coverages", this one is still empty. This isn't
correct, is it, this dict should hold the information about coverage
progress?

Mathieu van Echtelt

On Tue, Dec 2, 2008 at 10:20 PM, David Price <[hidden email]> wrote:

> You could try having a look at the package "BranchCoverage" that I just
> published to public store.  It's based on SUnitToo(verage) but removes
> prerequisites on SUnitToo, fixes things up for VW7.6 and changes from a
> viral mechanism of instrumenting methods (cool though it was) to an
> instrument-this-package method.  It doesn't as yet have a neat way to
> instrument code through the RB (would be nice to perhaps right click on a
> package and select enable coverage), but running a line of code to enable
> coverage isn't too onerous.
>
> David
>
>



--
AG5 - Product manager
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

Mathieu van Echtelt-2
Thanks all, it works now.

It only worked on bundles, to have it work on packages I had to change:

PackageModel >> allContainedItems ^#()

in

PackageModel >> allContainedItems ^#()
        ^Array with: self

Very strange though, because allContainedItems is from package
PackageCategories.

greetings,

Mathieu


On Wed, Dec 3, 2008 at 8:21 AM, Mathieu van Echtelt <[hidden email]> wrote:

> Hi David,
>
>
> First of all Thanks! (but don't stop reading, still some questions left)
>
> What you write sounds exactly what I need,  (also making it
> independent form sunittoo).
>
> About making it independent from sunittoo there were some issues remaining:
>
> - I had to change superclass of CoverageTestCase to
> XProgramming.Sunit.TestCase instead of Sunittoo's TestCase .
> - in MethodCoverage>>calculateCoveragesForClass: aClass inPundle:
> aPundle, the isTestCase is from Sunittoo package.
> - Removed Sunittoo as prerequisite from BrancheCoverage Package.
>
> Question: when you wrote: "It's based on SUnitToo(verage)" you mean
> it's inspired by, but I do not need to load SUnitToo(verage), right?
>
> Then I run the testcases of CoverageTestCase. They are all green.
>
> Then I executed:
>
> BranchCoverage.CoverageWrapper installOnPundleNamed: 'My package'
>
> Run some of my tests which should touch methods inside   'My package'.
>
> However, I still do not see coverage results!
>
> So unfortunately, my question remains: where/how should I see them, in
> the RB Browser?
>
> btw. After running the tests, I inspected dictionary
> "BranchCoverage.Coverages", this one is still empty. This isn't
> correct, is it, this dict should hold the information about coverage
> progress?
>
> Mathieu van Echtelt
>
> On Tue, Dec 2, 2008 at 10:20 PM, David Price <[hidden email]> wrote:
>> You could try having a look at the package "BranchCoverage" that I just
>> published to public store.  It's based on SUnitToo(verage) but removes
>> prerequisites on SUnitToo, fixes things up for VW7.6 and changes from a
>> viral mechanism of instrumenting methods (cool though it was) to an
>> instrument-this-package method.  It doesn't as yet have a neat way to
>> instrument code through the RB (would be nice to perhaps right click on a
>> package and select enable coverage), but running a line of code to enable
>> coverage isn't too onerous.
>>
>> David
>>
>>
>
>
>
> --
> AG5 - Product manager
>



--
AG5 - Product manager
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

Mathieu van Echtelt-2
Well, because it felt a bit too dangerous to change allContainedItems.

I changed the message from where it is sent into:

installOnPundle: aPundle

        aPundle isPackage
                ifTrue: [aPundle methods do: [:method | self
installOnMethodDefinition: method]]
                ifFalse:
                        [aPundle allContainedItems
                                do: [:pundle | pundle isPackage ifTrue: [pundle methods do:
[:method | self installOnMethodDefinition: method]]]].

Greetings
Mathieu

On Wed, Dec 3, 2008 at 8:33 AM, Mathieu van Echtelt <[hidden email]> wrote:

> Thanks all, it works now.
>
> It only worked on bundles, to have it work on packages I had to change:
>
> PackageModel >> allContainedItems ^#()
>
> in
>
> PackageModel >> allContainedItems ^#()
>        ^Array with: self
>
> Very strange though, because allContainedItems is from package
> PackageCategories.
>
> greetings,
>
> Mathieu
>
>
> On Wed, Dec 3, 2008 at 8:21 AM, Mathieu van Echtelt <[hidden email]> wrote:
>> Hi David,
>>
>>
>> First of all Thanks! (but don't stop reading, still some questions left)
>>
>> What you write sounds exactly what I need,  (also making it
>> independent form sunittoo).
>>
>> About making it independent from sunittoo there were some issues remaining:
>>
>> - I had to change superclass of CoverageTestCase to
>> XProgramming.Sunit.TestCase instead of Sunittoo's TestCase .
>> - in MethodCoverage>>calculateCoveragesForClass: aClass inPundle:
>> aPundle, the isTestCase is from Sunittoo package.
>> - Removed Sunittoo as prerequisite from BrancheCoverage Package.
>>
>> Question: when you wrote: "It's based on SUnitToo(verage)" you mean
>> it's inspired by, but I do not need to load SUnitToo(verage), right?
>>
>> Then I run the testcases of CoverageTestCase. They are all green.
>>
>> Then I executed:
>>
>> BranchCoverage.CoverageWrapper installOnPundleNamed: 'My package'
>>
>> Run some of my tests which should touch methods inside   'My package'.
>>
>> However, I still do not see coverage results!
>>
>> So unfortunately, my question remains: where/how should I see them, in
>> the RB Browser?
>>
>> btw. After running the tests, I inspected dictionary
>> "BranchCoverage.Coverages", this one is still empty. This isn't
>> correct, is it, this dict should hold the information about coverage
>> progress?
>>
>> Mathieu van Echtelt
>>
>> On Tue, Dec 2, 2008 at 10:20 PM, David Price <[hidden email]> wrote:
>>> You could try having a look at the package "BranchCoverage" that I just
>>> published to public store.  It's based on SUnitToo(verage) but removes
>>> prerequisites on SUnitToo, fixes things up for VW7.6 and changes from a
>>> viral mechanism of instrumenting methods (cool though it was) to an
>>> instrument-this-package method.  It doesn't as yet have a neat way to
>>> instrument code through the RB (would be nice to perhaps right click on a
>>> package and select enable coverage), but running a line of code to enable
>>> coverage isn't too onerous.
>>>
>>> David
>>>
>>>
>>
>>
>>
>> --
>> AG5 - Product manager
>>
>
>
>
> --
> AG5 - Product manager
>



--
AG5 - Product manager
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

David Lattimore
In reply to this post by Mathieu van Echtelt-2
On 03/12/08 18:33, Mathieu van Echtelt wrote:
> It only worked on bundles,
>  

Thanks for pointing that out.  I've published a fixed version.

Also, thanks to Tom and Travis for their suggestions on adding menu
items, I've integrated them.

> - I had to change superclass of CoverageTestCase to
> XProgramming.Sunit.TestCase instead of Sunittoo's TestCase .

I was probably going to leave the BranchCoverageTest package depending on SUnitToo - it has to depend on one of the SUnit packages.

> - in MethodCoverage>>calculateCoveragesForClass: aClass inPundle:
> aPundle, the isTestCase is from Sunittoo package.
> - Removed Sunittoo as prerequisite from BrancheCoverage Package.

Thanks, I've applied both of those.

Something else to note with the packages - they haven't had a whole lot of use.  A couple of results have seemed a bit suspicious, but I haven't investigated sufficiently to work out what's going on.  Also, I think there is probably still a good bit of simplification that could be done now that the viral instrumentation is no longer used.

David


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] code coverage tool (using SUnittoo)

Runar Jordahl
Great, so now we have a working code coverage tool. Maybe someone
could sum up what to load and how to use it in a blog post. I am sure
there is a larger audience having the need for such a tool. Or even
better: Cincom could include this into the base product.

Kind regards
Runar Jordahl
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc