Your SlideShare is downloading. ×
0
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Jessie - TDD in node.js using Jasmine
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Jessie - TDD in node.js using Jasmine

8,788

Published on

Jessie is a node.js runner for Jasmine BDD framework. …

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.

0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
8,788
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
67
Comments
0
Likes
7
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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
  • 4. expect(x).toEqual(y) expect(x).toBe(y) expect(x).toMatch(pattern) expect(x).toBeDefined() expect(x).toBeNull() expect(x).toBeTruthy() expect(x).toBeFalsy() expect(x).toContain(y) expect(x).toBeLessThan(y) expect(x).toBeGreaterThan(y) expect(fn).toThrow(e) Jasmine - matchers 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
  • 7. Jessie • node.js runner for Jasmine • extends Jasmine • introduces pending specs • improves error and failure reporting • multiple report formatters • supports CoffeeScript Sunday, June 12, 2011
  • 8. describe('Pending specs', function() { it("should work") it("should work with pending", function() { pending("TODO") }) }) Jessie - pending specs Sunday, June 12, 2011
  • 9. describe('Failing spec', function() { it("should fail", function() { expect(1).toEqual(2) }) }) Jessie - failure reporting Sunday, June 12, 2011
  • 10. Jessie - formatters Sunday, June 12, 2011
  • 11. Jessie - formatters Sunday, June 12, 2011
  • 12. describe('Sugar specs', function() { var number = 1 var array = [1,2] var func = function() {} it("should work", function() { "aaa".should_be("aaa") number.should_be(1) array.should_be([1,2]) func.should_be_a(Function) "bike courier".should_match("bike") }) it("should work with not", function() { "bbb".should_not_be("aaa") number.should_not_be(2) array.should_not_be([3,4]) }) }) Jessie - sugar Sunday, June 12, 2011
  • 13. describe 'OMG Coffee Spec', -> it "should work", -> expect(1).toEqual 1 it "should work", -> "foo".should_be "foo" Jessie - CoffeeScript Sunday, June 12, 2011
  • 14. github.com/futuresimple/jessie Sunday, June 12, 2011

×