Code coverage

Lukas Renggli renggli at
Tue Jan 17 12:28:46 UTC 2006

> Hi, is there any tool to do code coverage? (at method level is enough, i
> want to do something to check that unit test cover all the methods)

You might want to try something like that in any Squeak image:

tallies := IdentityDictionary new.
prev := [ MAFileModelTest suite run ].
thisContext sender
	runSimulated: prev
	contextAtEachStep: [ :curr |
		curr == prev ifFalse: [
				at: curr receiver
				ifAbsentPut: [ Set new ])
					add: curr selector ].
			prev := curr ] ].

There are some bugs in the simulator that prevent you from running
tests  that containing #should:raise: and #shouldnt:raise:, else this
technique works very well and requires no additional package.


Lukas Renggli

More information about the Squeak-dev mailing list