Book description
Get a concise introduction to Jasmine, the popular behavior-driven testing framework for JavaScript. This practical guide shows you how to write unit tests with Jasmine that automatically check for bugs in your application. If you have JavaScript experience—with knowledge of some advanced features—you’ll learn how to write specifications for individual components, and then use those specs to test the code you write.
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
Publisher resources
Table of contents
- Preface
- 1. Intro to Testing
- 2. Jasmine
- 3. Writing Good Tests
-
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
- 5. More Jasmine Features
- 6. Spies
- 7. Using Jasmine with Other Tools
- 8. Reference
- About the Author
- Colophon
- Copyright
Product information
- Title: JavaScript Testing with Jasmine
- Author(s):
- Release date: March 2013
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781449356378
You might also like
book
Python Crash Course, 3rd Edition
Python Crash Course is the world's best-selling guide to the Python guide programming language, with over …
book
Learning Web Design, 5th Edition
Do you want to build web pages but have no prior experience? This friendly guide is …
book
Webpack for Beginners: Your Step-by-Step Guide to Learning Webpack 4
Learn how to use Webpack from installation to configuration without the hassle of complex examples. Webpack …
book
Java Coding Problems
Develop your coding skills by exploring Java concepts and techniques such as Strings, Objects and Types, …