Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
AngularJS Web Application Development Blueprints

You're reading from   AngularJS Web Application Development Blueprints A practical guide to developing powerful web applications with AngularJS

Arrow left icon
Product type Paperback
Published in Aug 2014
Publisher Packt
ISBN-13 9781783285617
Length 300 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Vinci J Rufus Vinci J Rufus
Author Profile Icon Vinci J Rufus
Vinci J Rufus
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

AngularJS Web Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Introduction to AngularJS and the Single Page Application FREE CHAPTER 2. Setting Up Your Rig 3. Rapid Prototyping with AngularJS 4. Using REST Web Services in Your AngularJS App 5. Facebook Friends' Birthday Reminder App 6. Building an Expense Manager Mobile App 7. Building a CMS on the MEAN Stack 8. Scalable Architecture for Deployments on AWS 9. Building an E-Commerce Store AngularJS Resources Index

Writing automated tests


Our application is working fine, which is great; however, going forward, you would probably tinker with the code, refactor it, add some additional features, and so on. While doing so, it's important to make sure that we don't break anything.

Moreover, because our app makes use of a third-party API, which at times may go down or change, this will cause our app to fail.

In order to detect any breakages, it is vital that we have some kind of automated tests that can be run periodically or every time something changes in our code.

We will use Karma to run our Unit tests and Protractor for our End-to-End Testing.

Writing Unit tests with Karma

Karma is a test runner to run JavaScript Unit tests. We can use Jasmine, Mocha, or QUnit to write our test cases and run it using Karma.

Since we are going to be writing our Unit tests, to test our directive, we will write them in the test/unit/directivesSpec.js file.

We will replace the existing contents of this file with the following...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images