Wednesday, September 3rd, 2008
Category: JavaScript
, jQuery
, Testing
<
p
>
Chad Myers has a simple look at GUnit, the jQuery based unit test framework. His article explains how to get going, and walks through a test like this:
JAVASCRIPT:
-
-
module("Show and Hide");
-
-
test("should hide the element when hide is called", function(){
-
-
$("#testDiv").hide();
-
-
// actual, expected
-
equals
($
("#testDiv").
css("display"),
"none",
"The element should be hidden");
-
});
-
-
test("should show the element when show is called", function(){
-
-
// Arrange
-
$("#testDiv").css("display", "none");
-
-
// Act
-
$("#testDiv").show();
-
-
// Assert
-
// actual, expected
-
equals($("#testDiv").css("display"), "block", "The element should be visible");
-
});
-
- jQuery finds important role in Ajax-style open source framework development
The jQuery open source library and framework has gained greater attention among a slate of frameworks that includes Dojo, Prototype, GWT and others....
- How to use jQuery to solve Javascript browser compatibility problems
Javascript compatibility between Firefox, Internet Explorer and other browsers can make Ajax and Javascript effects a headache. Each browser does...
- Ajax testing: Using available tools is key
Ted Husted is a business analyst, author, consultant, and speaker. His books include JUnit in Action, Struts in Action, and Professional JSP Site...
- Microsoft PDC gives a taste of Windows 7, Visual Studio 2010
A pair of keynotes on day 2 of PDC gave developers a glimpse of Windows 7 and Visual Studio 2010, and then showed them how to build a basic...
- Unit testing in Visual Studio 2010
Visual Studio 2010 contains a unit testing framework, and I’ll show you how to use it to automate your own unit...
xor,
.
Which would you choose if you were starting a project today? jqUnit?
I don’t think there is noticeable difference for *new* project. If you don’t have old tests written in JSUnit, then both are the same for you. At the same time, both libraries are not that well documented, so there could be some subtle differences (I didn’t have time to compare code closely).