keepwalking
keepwalking

Reputation: 2654

How can i create JavaScript test cases

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

Upvotes: 2

Views: 11204

Answers (3)

Chetter Hummin
Chetter Hummin

Reputation: 6837

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

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

Upvotes: 2

mamoo
mamoo

Reputation: 8166

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.com/tutorials/javascript-ajax/testing-your-javascript-with-jasmine/

And here's a tutorial on jasmine-node:

http://www.2ality.com/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.com/2010-04-05/understanding-nodejs-require.html (broken link) http://coppieters.blogspot.be/2013/03/tutorial-explaining-module-export.html

Upvotes: 2

Bogdan Emil Mariesan
Bogdan Emil Mariesan

Reputation: 5647

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

You could try something like:

http://testcase.rubyforge.org/

Upvotes: 1

Related Questions