南特JavaScript 单元测试
下,我想要通过 Nant 脚本对我的 javascript 进行单元测试的最简单方法,我理想的用法是告诉它我的 src javascript 文件所在的位置,然后给它另一个文件夹,其中我的所有测试 javascript 文件所在......
理想情况 在互联网上进行侦察,似乎有两层,一层是实际的测试库,另一层是测试运行器。
至于实际的测试库,我希望它类似于 N/JUnit,我知道有 JSUnit,但它似乎不能按照我想要的方式使用,我确实找到了不同版本的 JSUnit (1.3)它可以与 Ant 一起使用,但将其放入 Nant 中似乎需要做大量的工作。
就跑步者而言,我不关心它在浏览器中运行的东西...我对我的 src js 代码使用 MVP 类方法,所以虽然底层视图使用 Jquery,但它都会被模拟出来,所以它不太这是一个很大的问题...
任何显示我如何将其连接到 Nant 的例子都会很棒!
I am ideally after the simplest way to unit test my javascript via my Nant script, my ideal usage would be telling it where my src javascript files reside, then giving it another folder where all my test javascript files reside....
From my quick scout on the interwebs it seems that there are 2 layers to this, one being the actual testing library, then the other being the test runner.
As far as the actual testing library I would like it to be similar to N/JUnit, I know there is JSUnit but it doesnt seem like it can be used in the way I want, I did find a different version of JSUnit (1.3) which can be used with Ant, but it seemed to be an awful lot of work to get it put into Nant.
As far as the runner I dont care about it running things in the browser... I am using a MVP sort of approach to my src js code, so although the underlying view uses Jquery it would all be mocked out, so its not too much of an issue...
Any examples showing how I could hook it into Nant would be great!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
忘记了这个问题在这里...
我最终使用 JsTestDriver 进行自动化单元测试,我已将其插入 nant 使用:
我遇到了一个恼人的问题,该问题没有在任何地方记录,只是在提出其他一些问题后才偶然发现,但它出现在我使用的版本上,它无法与相对路径一起正常工作,但在conf文件中,我有基本路径变量,该变量被我的构建脚本替换为令牌:
它运行我的所有测试并告诉我它们是否通过或失败了,这就是我所追求的......我希望这能让其他人快速启动并运行......
Forgot this question was on here...
I ended up using JsTestDriver for my automated unit testing, I have plugged this into nant using:
I faced an annoying issue, which was not documented anywhere and only happened to stumble across after asking some other questions, but it appears on the version I was using it would not work correctly with relative paths, but in the conf file I have the basepath variable which is token replaced by my build script:
That runs all my tests and tells me if they passed or failed, which is what I was after... I hope this gets someone else up and running quickly...