[Cosmo-dev] [Proposal] Use Windmill for JS Unit testing

Ted Leung twl at osafoundation.org
Fri Mar 30 15:20:19 PST 2007


On Mar 30, 2007, at 4:01 PM, Mikeal Rogers wrote:

> Can anyone tell me why jsunit is so overly complex?

Because it copied JUnit?

This stuff is in here because John Townsend started off on this and  
didn't finish.  Now I am trying to pick it up.  I'm happy to have you  
and Adam pick it up if you like.

>
> Honestly I think the easiest thing to do would be replace jsunit  
> with something easier to use and write tests in.

There's a number of js unit test frameworks out there, most of them  
as bad or worse.

>
> - There is no reason that unit test suites can't just be a  
> single .js file
> - There is no reason that we can't cut out most of the setup steps  
> to write tests by just loading a page in windmill before running  
> tests, setting up all the regular application environment

The only reason for this is if for some reason a person didn't want  
to have to have windmill to run the unit tests.

> - Replacing the assertion module jsunit uses (http:// 
> www.jsunit.net/) is about an hour long task and could free us of  
> all this cruft.
>
> I really just don't get this. You _must_ run these tests in the  
> browser, so why go so far out of your way to not load the regular  
> application environment before running the unit tests, instead you  
> have to setup half of the application environment yourself in the  
> setup().
>
> I might just be totally missing the point but I don't see any  
> reason for unit tests to be html pages, the code below should be  
> enough to define a unittest.
>
> environment_url = "/cosmo/webui"
>
> function testWithValidArgs() {
>     assertEquals("2 times 3 plus 5 is 11", 11, multiplyAndAddFive 
> (2, 3));
>     assertEquals("Should work with negative numbers", -15,  
> multiplyAndAddFive(-4, 5));
> }
>
> We can handle loading the unittest modules and loading the url  
> before running the tests.
>
> Any issues or suggestions?

I don't care so long as the test don't rely on windmill being  
there.   I only envisioned using windmill as a way of triggering an  
in browser test.   I wasn't thinking of making the unit tests  
dependent on Windmill.    My other constraint is that I don't want to  
see us spending time writing our own js unit test framework.   Aside  
from that, Bobby is the person who has/had the most opinions about  
this topic.

Ted


More information about the cosmo-dev mailing list