JavaScript Testing with Jasmine
O'Reilly Media, Inc, USA (Verlag)
978-1-4493-5637-8 (ISBN)
Throughout the book, author Evan Hahn focuses primarily on methods for testing browser-based JavaScript applications, but you’ll also discover how to use Jasmine with CoffeeScript, Node.js, Ruby on Rails, and Ruby without Rails. You won’t find a more in-depth source for Jasmine anywhere.
- Get an overview of both test-driven and behavior-driven development
- Write useful specs by determining what you need to test—and what you don’t
- Test the behavior of new and existing code against the specs you create
- Apply Jasmine matchers and discover how to build your own
- Organize code suites into groups and subgroups as your code becomes more complex
- Use a Jasmine spy in place of a function or an object—and learn why it’s valuable
Evan Hahn is a JavaScript developer currently enrolled at University of Michigan. He started coding in BASIC when he was 6 years old. In high school, he was the webmaster of his high school's online newspaper, where he learned how to make more of a real website (PHP, mySQL, JavaScript, jQuery). He most recently worked at UniversityNow, an educational startup in Palo Alto.
Chapter 1 Intro to Testing
What Is Software Testing?
Why Is It Useful?
Test-Driven Development
Behavior-Driven Development
Chapter 2 Jasmine
What Is Jasmine?
Getting Set Up with Jasmine
Testing Existing Code with describe, it, and expect
Matchers
Writing the Tests First with Test-Driven Development
Chapter 3 Writing Good Tests
Cardinal Rule: When in Doubt, Test
Test Components
Black-Box Testing
Chapter 4 Matchers in Depth
Equality: toEqual
Identity: toBe
Yes or No? toBeTruthy, toBeFalsy
Negate Other Matchers with not
Check If an Element Is Present with toContain
Is It Defined? toBeDefined, toBeUndefined
Nullness: toBeNull
Is It NaN? toBeNaN
Comparators: toBeGreaterThan, toBeLessThan
Nearness: toBeCloseTo
Using toMatch with Regular Expressions
Checking If a Function Throws an Error with toThrow
Custom Matchers
Chapter 5 More Jasmine Features
Before and After
Nested Suites
Skipping Specs and Suites
Matching Class Names
Chapter 6 Spies
The Basics: Spying on a Function
Calling Through: Making Your Spy Even Smarter
Making Sure a Spy Returns a Specific Value
Replacing a Function with a Completely Different Spy
Creating a New Spy Function
Creating a New Spy Object
Chapter 7 Using Jasmine with Other Tools
Jasmine and CoffeeScript
Jasmine and Node.js
Jasmine and Ruby on Rails
Jasmine with Non-Rails Ruby
More Tools
Chapter 8 Reference
Jasmine on the Web
The Basic Structure of a Suite
Matchers Reference
List of Falsy Values
Reserved Words in Jasmine
Colophon
Erscheint lt. Verlag | 7.5.2013 |
---|---|
Verlagsort | Sebastopol |
Sprache | englisch |
Maße | 178 x 233 mm |
Gewicht | 100 g |
Einbandart | kartoniert |
Themenwelt | Informatik ► Software Entwicklung ► Qualität / Testen |
Mathematik / Informatik ► Informatik ► Web / Internet | |
ISBN-10 | 1-4493-5637-0 / 1449356370 |
ISBN-13 | 978-1-4493-5637-8 / 9781449356378 |
Zustand | Neuware |
Haben Sie eine Frage zum Produkt? |
aus dem Bereich