Hi -
Is there any variant of TestRunner (or anything else based on the SUnit framework) which spits out coverage information for the code being executed via some test case (either classes, methods, lines, bytecodes etc)? If so, where can I find it?
Thanks, - Andreas
I was trying to do something like that a couple of months ago.. but I don't had enough time to finish it :( I could try to make a minimal usable version by the end of this week if you want.
(the info about simulating evaluation of blocks that Lucas Rengli gave me was very useful, maybe you can found it in the list archives... look for the thread: "Code Coverage"**)
On 4/4/06, Andreas Raab andreas.raab@gmx.de wrote:
Hi -
Is there any variant of TestRunner (or anything else based on the SUnit framework) which spits out coverage information for the code being executed via some test case (either classes, methods, lines, bytecodes etc)? If so, where can I find it?
Thanks,
- Andreas
Thanks. Yes, I do know about the code simulation features, I just don't have the time to implement any of that stuff so I was wondering if anyone had done that already.
Cheers, - Andreas
Diego Fernandez wrote:
I was trying to do something like that a couple of months ago.. but I don't had enough time to finish it :( I could try to make a minimal usable version by the end of this week if you want.
(the info about simulating evaluation of blocks that Lucas Rengli gave me was very useful, maybe you can found it in the list archives... look for the thread: "Code Coverage"**)
On 4/4/06, *Andreas Raab* <andreas.raab@gmx.de mailto:andreas.raab@gmx.de> wrote:
Hi - Is there any variant of TestRunner (or anything else based on the SUnit framework) which spits out coverage information for the code being executed via some test case (either classes, methods, lines, bytecodes etc)? If so, where can I find it? Thanks, - Andreas
I was trying to do something like that a couple of months ago.. but I don't had enough time to finish it :( I could try to make a minimal usable version by the end of this week if you want.
(the info about simulating evaluation of blocks that Lucas Rengli gave me was very useful, maybe you can found it in the list archives... look for the thread: "Code Coverage")
I think such a coverage tool was included in my test-runner up to the version stated below, maybe also later versions. It spits out an environment (from the refactoring browser) of all the methods that have been touched while executing the tests.
http://mc.lukas-renggli.ch/essential/Essential-lr.11.mcz
I removed it because it didn't work together with exception handling, unfortunately there are some subtle bugs in the code simulation.
Lukas
-- Lukas Renggli http://www.lukas-renggli.ch
There is a code coverage tool for VisualWorks that is based on method wrappers. A couple of students in my OOP&D class this semester are trying to make a version for Squeak. There might be one in a month or so.
-Ralph Johnson
I just uploaded to SqueakMap some tools for code coverage, the package is named with the original name of.... "CodeCoverage" :) An usage example:
| watcher report |
watcher := MethodExecutionWatcher forAllMethodsOfPackageNamed: 'CodeCoverage-Model' duringExecutionOf: [ MethodExecutionReportTest suite run ].
report := watcher value.
(MethodExecutionReportWriter on: Transcript) write: report
The unit test MethodExecutionWatcherTest contains more examples. It simply uses the block simulation, and creates a report of the executed methods.
Andreas, note that this version is a little slow :( I think is because I'm using MethodReference and a Set (so each time that a "step" is evaluated an instance of MethodReference is created is checked for inclusion against the set). In a previous version I was using directly a compiled method, and a IdentitySet, it was fast but I don't like the idea of holding instances of compiled methods (well the next version will be faster).
Ralph, my first attempt was using MethodWrappers. Then Steph told me that Squeak 3.9 can simulate the execution, so I changed the implementation. (I think that the later was a lot easier). I known that MW is portable, but maybe if your students are creating an UI for Squeak they can take a look to the uploaded package.
Cheers, Diego,-
On 4/4/06, Ralph Johnson johnson@cs.uiuc.edu wrote:
There is a code coverage tool for VisualWorks that is based on method wrappers. A couple of students in my OOP&D class this semester are trying to make a version for Squeak. There might be one in a month or so.
-Ralph Johnson
Nice work Diego, but based on what Lukas said about the troubles with exceptions in running under simulation, do you still have your original implementation via Method Wrappers?
Also, is there any way to specify multiple packages, something like:
watcher := MethodExecutionWatcher forAllMethodsOfPackagesNamed: #('myPackage1' 'myPackage2') duringExecutionOf: [ MethodExecutionReportTest suite run ].
?
Thanks..
--- Diego Fernandez diegof79@gmail.com wrote:
I just uploaded to SqueakMap some tools for code coverage, the package is named with the original name of.... "CodeCoverage" :) An usage example:
| watcher report |
watcher := MethodExecutionWatcher forAllMethodsOfPackageNamed: 'CodeCoverage-Model' duringExecutionOf: [ MethodExecutionReportTest suite run ].
report := watcher value.
(MethodExecutionReportWriter on: Transcript) write: report
The unit test MethodExecutionWatcherTest contains more examples. It simply uses the block simulation, and creates a report of the executed methods.
Andreas, note that this version is a little slow :( I think is because I'm using MethodReference and a Set (so each time that a "step" is evaluated an instance of MethodReference is created is checked for inclusion against the set). In a previous version I was using directly a compiled method, and a IdentitySet, it was fast but I don't like the idea of holding instances of compiled methods (well the next version will be faster).
Ralph, my first attempt was using MethodWrappers. Then Steph told me that Squeak 3.9 can simulate the execution, so I changed the implementation. (I think that the later was a lot easier). I known that MW is portable, but maybe if your students are creating an UI for Squeak they can take a look to the uploaded package.
Cheers, Diego,-
On 4/4/06, Ralph Johnson johnson@cs.uiuc.edu wrote:
There is a code coverage tool for VisualWorks that is based on
method
wrappers. A couple of students in my OOP&D class this semester are
trying
to make a version for Squeak. There might be one in a month or so.
-Ralph Johnson
On 4/5/06, Chris Muller chris@funkyobjects.org wrote:
Nice work Diego, but based on what Lukas said about the troubles with exceptions in running under simulation, do you still have your original implementation via Method Wrappers?
Nop :( (if I have time today would test the exception handling)
Also, is there any way to specify multiple packages, something like:
watcher := MethodExecutionWatcher forAllMethodsOfPackagesNamed: #('myPackage1' 'myPackage2') duringExecutionOf: [ MethodExecutionReportTest suite run ].
?
The MethodExecutionWatcher receives a collection with instances of MethodReference, ie:
MethodExecutionWatcher forAll: (Array with: (MethodReference class: Object selector: hash) duringExecutionOf: [].
#forAllMethodsOfPackageNamed:duringExecutionOf: it's only a factory method for convenience. It's the same as: MethodExecutionWatcher forAll: (PackageInfo named: 'PackageName') methods duringExecutionOf: [].
Implementing #forAllMethodsOfPackagesNamed:duringExecutionOf: should be straight forward. :) (thanks for the suggestion)
Note that, the .mcz file that I have uploaded to SqueakMap is corrupt :( I will upload a correct version this night, sorry for the inconvenience.
squeak-dev@lists.squeakfoundation.org