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

发表于:2013-01-11来源:web开发社区作者:Hazem Saleh点击数: 标签:JavaScript
22 assertEquals ( Password is not validated correctly! , This field is required , 23 document.getElementById( passwordMessage ).innerHTML); 24 }; 25 26 ApplicationUtilTest.prototype.testValidateLoginF
22     assertEquals ("Password is not validated correctly!", "This field is required"
23     document.getElementById("passwordMessage").innerHTML);    
24 };
25  
26 ApplicationUtilTest.prototype.testValidateLoginFormWithEmptyUserName = function () {
27     var applicationUtil = new appnamespace.ApplicationUtil ();
28  
29     /* Simulate empty user name and password */
30     document.getElementById("username").value = "";
31     document.getElementById("password").value = "anyPassword";    
32  
33     applicationUtil.validateLoginForm ();
34  
35     assertEquals("Username is not validated correctly!"

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