|
You may remember me writing about JavaScriptMVC about a month ago. Well, they have made a very cool plug-in for JavaScriptMVC (although you can also use the plug-in for non-JavaScriptMVC features) called Test that makes JavaScript testing much easier.
Below is an excerpt from the post on the plug-in.
Easy to use
Test is optimized for easy use. But, every library
says that. Here's why we mean it:
1. JavaScriptMVC's Console provides helpful messages to guide you through
setup
Test runner window
2. Asynchronous event tests avoid using nested functions to keep your
code easier to understand
test_open: function(){
this.next(this.DirectoryDblclick(2));
},
assert_open: function(params){
this.assertEqual(5, params.element.childNodes.length);
}
Asynchronous event testing
3. If you use Controller, helper methods are automatically created that
simulate each controller action's event, such as TodoClick
4. Event simulation syntax so simple your grandma could understand it2
this.Keypress(element, 'h');
YAHOO.util.UserAction.keypress(element, { charCode: 72 });
Event simulation syntax comparison
You can read the full post and see a demo of the plug-in here.
Further more the plug-in does more than just unit tests. It lets you simulate user interactions with your page:
- Cross browser support for typical DOM events, like keypress, click, submit, blur, and focus
- Simulate writing text or dragging an element
This plug-in looks pretty good and I plan on using it in a future application using JavaScriptMVC. Anything that makes JavaScript testing easier is a very good thing!

|
|
Read more...
|