Jessie is a node.js runner for Jasmine BDD framework.
It allows running of Jasmine specs in node.js environment, adds pending specs, improves error and failure reporting.
Iasi code camp 12 october 2013 jax-rs-jee-ecosystem - catalin mihalache
Jessie - TDD in node.js using Jasmine
1. jessie
TDD in node.js using Jasmine
Marcin Bunsch
nodecamp.eu 2011
Sunday, June 12, 2011
2. Jasmine
• JavaScript testing framework
• does not depend on any other JavaScript frameworks.
• does not require a DOM.
• does not pollute prototypes
• similar to RSpec
Sunday, June 12, 2011
3. describe('Simple specs', function() {
it("should work", function() {
expect("aaa").toEqual('aaa')
})
it("should work with not", function() {
expect("bbb").not.toEqual('aaa')
})
})
Jasmine - suites and specs
Sunday, June 12, 2011
5. describe('Before and after specs', function() {
var a = 1
beforeEach(function() { a += 1 })
afterEach(function() { a += 1 })
it("should execute the beforeEach", function() {
expect(a).toEqual(2)
})
it("should execute the afterEach", function() {
expect(a).toEqual(4)
})
})
Jasmine - before and after
Sunday, June 12, 2011
6. describe('Spies', function() {
var some_object = { some_func: function() {} }
it("should be able to spy on existing objects", function() {
spyOn(some_object, 'some_func')
some_object.some_func()
expect(some_object.some_func).toHaveBeenCalled()
})
it("should be able to create spies", function() {
var spy_func = jasmine.createSpy()
spy_func()
expect(spy_func).toHaveBeenCalled()
})
})
Jasmine - spies
Sunday, June 12, 2011