Jasmine
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
525
On Slideshare
525
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
2
Comments
0
Likes
1

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. 苏河
  • 2. • 界面老是改,测毛线• 都是业务代码,测毛线• 项目时间太紧,测毛线• 测毛线,还是目测给力……
  • 3. 产品的变化• RIA• Base on Browser• Heavy Javascript• Html 5
  • 4. 开发量的变化 Server Browser Server Browser
  • 5. 前端关注点的变化 内部质量 外部质量 可维护性 前 功能 性能 端 质 界面 设计模式 量 开发效率
  • 6. 困难重重 • 浪费太多时间How? • 效率太低,意义不大 • 从没写过javascript的单元测试
  • 7. Jasmine• Jasmine是一个BDD的javascript单 元测试框架
  • 8. Jasmine• 语法简单• 代码易读性• 不依赖其他js框架• 敏捷• Nodejs、ruby、java、html
  • 9. Specs
  • 10. Expectations
  • 11. Suites
  • 12. Nested Describes
  • 13. Disabling Tests & Suites
  • 14. Matchers
  • 15. Your matchers
  • 16. Before and After
  • 17. Spies matchers• expect(x).toHaveBeenCalled();• expect(x).toHaveBeenCalledWith(arguments);• expect(x).not.toHaveBeenCalled();• expect(x).not.toHaveBeenCalledWith(argume nts);
  • 18. Spies• spyOn(x, method).andCallThrough();• spyOn(x, method).andReturn(arguments);• spyOn(x, method).andThrow(exception);• spyOn(x, method).andCallFake(function);• spyOn(x, method).andReturn(value1); ... ; x.method.andReturn(value2);
  • 19. spies
  • 20. Asynchronous specs
  • 21. waits
  • 22. waitsFor• waitsFor(function, optional message, optional timeout)
  • 23. 爱逛街demo• 是否有问题?
  • 24. 预告片• 如何更好的架构可测试代码• 如何集成到klude测试平台• ……
  • 25. QA