Skip to content

Tests with Casperjs

Hadrien Lanneau edited this page Dec 10, 2013 · 9 revisions

Install casperjs :

npm install -g casperjs

Then launch it by typing :

casperjs yoshioka.js/tools/casper/index.js --host=http://localhost:1636 [options]

Will start all the tests. Yoshioka server must be running.

Options :

  • --host=http://myhost : mandatory, set the host where the tests are hosted
  • --ignore-ssl-errors=yes : allow to perform tests on a SSL server
  • --only=path/to/the/test/module/to/test : allow to start a test for a unique module. The path is the module name you wrote in your javascript file next to @module
  • --logLevel=info : Logging level, values can be :
    • none : no logging at all
    • info : Name of tests performed and individual results
    • error : Add the errors with details
    • debug : All the debug get from the brower console

Exemples : casperjs yoshioka.js/tools/casper/index.js --ignore-ssl-errors=yes --host=https://my.project-dev.com:1636 --logLevel=error

casperjs yoshioka.js/tools/casper/index.js --ignore-ssl-errors=yes --host=https://my.project-dev.com:1636 --logLevel=debug --only=ob/views/write/tests/models/post

The script will exit with the number of fails as status code. So, if no error occured, it will exits with status 0, which is a good thing.

Clone this wiki locally