Jun
14
2008
This is something we forgot on our way with coverage tools over the years and I think, needs to be restated. Its really not important how much code is covered by your unit tests(assuming they are good) but rather which parts of code is not been covered by your tests.
Jun
10
2008
Making tests easy for your fingers helps you to write more tests even if its for JavaScript. I really like Shoulda unit testing library for ruby and thought of hacking that out something similar for JavaScript (my current favorite language). This is how your test will look like
context("An Order form", function(){
setup(function(){
//real test this could come from dom object
this.user = { name:"Nilanjan"}
})
should("validate user name", function(){
assertTrue(validateName(this.user.name))
})
context("with guest permission", function(){
setup(function(){
this.user.openid = "http://some.openid.url"
})
should("have openid url", function(){
assertNotNull(this.user.openid)
})
})
})
and it produces
An order form should validate user name
An order form with guest permission should have openid url
And here is the shoulda for javascript file. I am planning implement some matcher based expectations as well, maybe hamcrest could be good starting point.
Let me know what you guys think?