Testowanie JavaScript       Tomasz Bąk    t.bak@selleo.com
Dlaczego JavaScript?użytkownicy oczekują coraz większejużyteczność interfejsów i szybkości      JavaScript to zapewnia
Dlaczego Jasmine?        dobrze integruje się z Rails       składnia zbliżona do RSpec   obsługa CoffeeScript / Asset Pipe...
JavaScript || CoffeeScriptdescribe("Calculator", function() {                   describe "Calculator", ->  describe("#add"...
Matchery  expect($(<div class="some-class"></div>)).toHaveClass("some-class")expect($(<div class="some-class"></div>)).not...
Demohttp://github.com/tb/testing-javascript
Dziękit.bak@selleo.com
Upcoming SlideShare
Loading in...5
×

Testowanie JavaScript

384

Published on

Hackfest #3 Bielsko-Biała

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
384
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Testowanie JavaScript"

  1. 1. Testowanie JavaScript Tomasz Bąk t.bak@selleo.com
  2. 2. Dlaczego JavaScript?użytkownicy oczekują coraz większejużyteczność interfejsów i szybkości JavaScript to zapewnia
  3. 3. Dlaczego Jasmine? dobrze integruje się z Rails składnia zbliżona do RSpec obsługa CoffeeScript / Asset Pipelinematchery jQuery, fixturki widoków, Sinon.JS (test spies, stubs & mocks) tryb standalone
  4. 4. JavaScript || CoffeeScriptdescribe("Calculator", function() { describe "Calculator", -> describe("#add", function() { return it("adds two numbers", function() { describe "#add", -> var calculator; calculator = new Calculator(); it "adds two numbers", -> return expect(calculator.add(1, 1)).toEqual(2); calculator = new Calculator() }); expect(calculator.add(1, 1)).toEqual 2 }); describe("#subtract", function() { describe "#subtract", -> return it("subtracts two numbers", function() { var calculator; it "subtracts two numbers", -> calculator = new Calculator(); calculator = new Calculator() return expect(calculator.subtract(10, expect(calculator.subtract(10, 1)).toEqual 9 1)).toEqual(9); }); }); ...});
  5. 5. Matchery expect($(<div class="some-class"></div>)).toHaveClass("some-class")expect($(<div class="some-class"></div>)).not.toHaveClass("some-class") expect($(<div>some text</div>)).toHaveText(some text) expect($form).toHandle("submit") … beforeEach(function() { this.addMatchers({ toBeACalendar: function() { return this.actual.hasClass("hasDatepicker"); }, ...
  6. 6. Demohttp://github.com/tb/testing-javascript
  7. 7. Dziękit.bak@selleo.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×