Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Ext JS Application Development Blueprints

You're reading from   Ext JS Application Development Blueprints Develop robust and maintainable projects that exceed client expectations using Ext JS

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781784395308
Length 340 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (13) Chapters Close

Preface 1. Introduction FREE CHAPTER 2. MVC and MVVM 3. Application Structure 4. Sencha Cmd 5. Practical – a CMS Application 6. Practical – Monitoring Dashboard 7. Practical – an E-mail Client 8. Practical – Questionnaire Component 9. A Shopping Application 10. Debugging and Performance 11. Application Testing Index

Faking it with mocks

When it's up and running, our application still has one giant dependency: the server. During integration testing, this means that the server-side database needs to be primed with test data, and test suite will result in many requests being sent back and forth. In a large test suite, this can be slow and the database setup can be painful.

A common resolution to this problem is to bypass the server API altogether. When our application makes an Ajax request, we can hijack the XMLHttpRequest and feed the calling code some static test data instead.

To demonstrate this and show the flexibility of the technique, we'll create a small Jasmine test case that shows how to supply a product store with mock JSON data. Although, faking an Ajax request is really useful in integration tests, this will show off the technique in a succinct way that can be used in both unit and integration testing.

We'll be using a feature of Ext JS that isn't included by default: Simlets...

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 $19.99/month. Cancel anytime