[ANN] BrowseUnit v4 preview: feedback needed

Colin Putney cputney at wiresong.ca
Fri Mar 5 15:36:12 UTC 2004


On Mar 5, 2004, at 6:48 AM, Markus Gaelli wrote:

Hi Markus,

I'm not really sure why, but I have a vague feeling that composing 
tests isn't a good idea. Why do you want to make the same assertions 
over and over? Once per run is enough, no?

I tend to want to factor "set up" type things into #setUp, 
TestResources, or helper methods in the test. So here's your SM 
example:

SMAccountResource>>setUp
	foo := SMAccount new signature: 'Mr. Foo'; email: 'foo at user.com'; 
initialis: 'mf'.
	bar := SMAccount new signature: 'Mr. Bar'; email: 'bar at user.com'; 
initialis: 'mb'.

SMAccountResource>>fo	o
	^ foo

SMAccountResource>>bar
	^ bar


SMAccountTest>>testAdmin
	self deny:  SMAccountResource current foo isAdmin.

SMAccountTest>>testAdvogatoId
	self assert: SMAccountResource current foo advogatoId isEmpty


SMSqueakMapTest>>setUp
	map := self createMap.
	
SMSqueakMapTest>>addAccounts
	map
		addObject: SMAccountResource current foo.
		addObject: SMAccountResource current bar.

SMSqueakMapTest>>testAddAccounts
	self addAccounts
	"do some assertions"

SMSqueakMapTest>>testAccountsByInitials
	self addAccounts.
	sortedAccounts := map accountsByInitials.
	self assert: (sortedAccounts first initials = 'mb')
	self assert: (sortedAccounts last initials = 'mf')

	




More information about the Squeak-dev mailing list