Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Backbone.js Testing
  • Table Of Contents Toc
Backbone.js Testing

Backbone.js Testing

By : Ryan Glenn Roemer
4.9 (14)
close
close
Backbone.js Testing

Backbone.js Testing

4.9 (14)
By: Ryan Glenn Roemer

Overview of this book

Table of Contents (13 chapters)
close
close
Backbone.js Testing
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1
Index

Trying out some different styles


Let's look at examples of the two most common interfaces for Mocha and Chai—BDD and TDD.

Mocha and Chai BDD interfaces

The Mocha BDD interface provides four main functional units:

  • before(): This is a setup that occurs once before all the tests within a suite are run. Mocha also provides a beforeEach() function that runs before each test in a suite.

  • after(): This is a setup that occurs once after all tests in a suite are run, with the afterEach() alternative that runs before each test.

  • describe(): This specifies a test suite and can be nested within other describe() functions.

  • it(): This defines a single test function containing one or more assertions.

Chai's BDD style uses expect or should to make dot-notation assertion chains.

We can create a basic test file chapters/03/test/js/spec/bdd.spec.js, which uses all of these components. We name the suite with describe(), add/remove a function with before()/after(), and test it with an it() specification declaration...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Backbone.js Testing
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon