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

Mikeal Rogers mikeal at osafoundation.org
Fri Mar 30 15:01:38 PST 2007


Can anyone tell me why jsunit is so overly complex?

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

- 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
- 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?

-Mikeal

On Mar 30, 2007, at 1:43 PM, Ted Leung wrote:

> Start here: <http://svn.osafoundation.org/server/cosmo/trunk/cosmo/ 
> src/test/unit/js/>.   The unit tests are minimal, pending getting a  
> decent runner system going.
>
> Ted

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.osafoundation.org/pipermail/cosmo-dev/attachments/20070330/9ff1fa7c/PGP.pgp


More information about the cosmo-dev mailing list