高效的JavaScript代码单元测试方法(9)

发表于:2013-01-11来源:web开发社区作者:Hazem Saleh点击数: 标签:JavaScript
36 This field is required , document.getElementById( usernameMessage ).innerHTML); 37 assertEquals( Password is not validated correctly! , 38 , document.getElementById( passwordMessage ).innerHTML); 3
36     "This field is required", document.getElementById("usernameMessage").innerHTML);
37     assertEquals("Password is not validated correctly!"
38     "", document.getElementById("passwordMessage").innerHTML);    
39 };
40  
41 ApplicationUtilTest.prototype.testValidateLoginFormWithEmptyPassword = function () {
42     var applicationUtil = new appnamespace.ApplicationUtil ();
43  
44     document.getElementById("username").value = "anyUserName";
45     document.getElementById("password").value = "";    
46  
47     applicationUtil.validateLoginForm ();
48  
49     assertEquals("Username is not validated correctly!"

原文转自:http://www.ltesting.net