Code coverage

Lukas Renggli renggli at gmail.com
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: [
			(tallies
				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

--
Lukas Renggli
http://www.lukas-renggli.ch



More information about the Squeak-dev mailing list