当前注册人数155278人 邮箱: 密码: 注册新用户 忘记密码
首页 C/C++/MFC C# ASP.NET VB.NET MATLAB   站内搜索 BBS讨论社区 下载代码说明/积分规则
为什么要注册?

1. 可以直接免费从本站下载代码,防止邮件发送不到您的邮箱,或登录不了国外网站

2. 可以设定关键字,当有您关心的代码收录时,邮件通知您

3. 对这里的代码进行评分和评论

4. 可以和大家一起分享你的源代码,得到更多的建议

Unit Test for JavaScript

JavaScript单元测试组件源代码及教程

2007年12月22日
JScript
本程序使用了较为高级的DCOM和javascript编写了用于单元测试的Javascript控件,随附的文章帮助你如何简单的使用它用于Javascript的单元测试,以提高客户端脚本的安全和稳定。
 
相关知识
//Create a test case
            function TestGuidAlgorithm()
            {
                Console.Out.Write("Test guid algorithm...");

                for(var i = 0; i<3; i++)
                {
                    var currentUid = guidComponent.GetNew();
                    Assert.That( currentUid, new Is.EqualTo("o_" + i) );
                }
                
                Console.Out.Write("done!");
            }
            //Add test case to test fixture
            guidTestFixture.AddTest(TestGuidAlgorithm);
            
            //Create another test case
            function TestDifferentGuids()
            {
                Console.Out.Write("Test different guids algorithm...");

                for(var i = 0; i<3; i++)
                {
                    var currentUid = guidComponent.GetNew();
                    //Assert.That( currentUid, new Is.NotEqualTo("o_" + i) );
                    //Force guid algorithm to fail (just for illustration, you don't really want your tests to fail right?)
                    Assert.That( currentUid, new Is.EqualTo("o_" + i) );
                }
                
                Console.Out.Write("done!");
            }
            //Add test case to test fixture
            guidTestFixture.AddTest(TestDifferentGuids);
源代码原文下载:
Unit Test for JavaScript How to strengthen your client-side code and improve reliability. Unit tests are unquestionable friends of every developer and, if you don't think that way, maybe it's because you never tried it before (see NUnit for more Unit Tests information). I'm not covering Unit Tests or Test Driven programming here, but keep in mind that it makes your code reliable, makes you confident after code changes and makes your Boss cheerful (which is good, right?). Remember that this client-side unit test algorithm is a newly born idea, not a solid development with years of usage like server-side unit test software. This means both "few functionality are available" and "report any bugs you find, please".

源码图片

从本站下载附件及源代码(1个附件,已经成功下载38次)

最值得关注的外文源代码

Openbravo ERP
Bubble Tooltips
AJAX Fisheye List Widget
Ajax Tabs Content Script (v 2.0)
评论(评论是增加积分的一个有效途径)
字数在300字内
请如实评论
本源代码共评论7次,此处显示最近7次评论! 查看所有评论

小猪仔  2009年06月22日
很好用
ryan  2009年04月07日
minesks  2009年02月16日
魔术师  2008年11月24日
先下来看看
she1987  2008年11月08日
谢谢
有心  2008年09月23日
先下来用一下再说,不知道如何
lry  2008年08月29日
JavaScript单元测试组件源代码及教程
CopyRight (C) codesoso.com 2007-2009 All Rights Reserved   免责声明
京ICP备08011023号