最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

unit testing - How can i create JavaScript test cases - Stack Overflow

programmeradmin0浏览0评论

I am currently working on some test cases for my website. I've managed to test the back-end functionality using the simple-test framework.

I have some important javascript tools that requires some automatic testing. I know javascript is a client side language and it requires a browser, i am just wondering if its something i can do.

Notice the test must run from Linux CLI.

Thank you

I am currently working on some test cases for my website. I've managed to test the back-end functionality using the simple-test framework.

I have some important javascript tools that requires some automatic testing. I know javascript is a client side language and it requires a browser, i am just wondering if its something i can do.

Notice the test must run from Linux CLI.

Thank you

Share Improve this question asked Mar 30, 2012 at 9:16 keepwalkingkeepwalking 2,6546 gold badges32 silver badges64 bronze badges 0
Add a ment  | 

3 Answers 3

Reset to default 2

You can install node.js with jasmine-node package to run your tests using cli:

Here's a brief intro to Jasmine:

http://net.tutsplus./tutorials/javascript-ajax/testing-your-javascript-with-jasmine/

And here's a tutorial on jasmine-node:

http://www.2ality./2011/10/jasmine.html

PS

In order to reference the code to be tested is useful to grasp how module.export works on Node.js ... here you'll find all the info you need to get started: http://jherdman.github./2010-04-05/understanding-nodejs-require.html (broken link) http://coppieters.blogspot.be/2013/03/tutorial-explaining-module-export.html

Jasmine is what I use for my Javascript testing. It can be found here : https://github./jasmine/jasmine (UPDATED -- 2015)

I also use JSCoverage to test my code coverage. It can be found here : http://siliconforks./jscoverage/

There are several unit testing frameworks out there written for javascript.

You could try something like:

http://testcase.rubyforge/

发布评论

评论列表(0)

  1. 暂无评论