Page 1 of 1

unit testing

PostPosted: Mon Dec 01, 2014 2:33 pm
by TheBenji
Hey,

do you guys do any kind of unit testing for your games?
If so, do you mind sharing your experiences? What works well for you and what doesn't? Frameworks you are using and so on :)

Cheers

Re: unit testing

PostPosted: Tue Feb 17, 2015 10:01 pm
by robaldred
Hey
I use grunt and the grunt-mocha-cli module, which allows you to run mochajs with grunt
Checkout the docs here: http://mochajs.org/

It allows you to write tests like this:

Code: Select all
describe('Array', function(){
  describe('#indexOf()', function(){
    it('should return -1 when the value is not present', function(){
      [1,2,3].indexOf(5).should.equal(-1);
      [1,2,3].indexOf(0).should.equal(-1);
    })
  })
})