Book Image

Mastering ArcGIS Server Development with JavaScript

By : Raymond Kenneth Doman
Book Image

Mastering ArcGIS Server Development with JavaScript

By: Raymond Kenneth Doman

Overview of this book

Table of Contents (18 chapters)
Mastering ArcGIS Server Development with JavaScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Jasmine testing framework


If you're looking for a simple BDD framework to test your application, Jasmine might have what you need. Jasmine is a framework-independent BDD library that can be used to run tests on JavaScript applications. It can either be installed through Node.js, or the library can be downloaded and copied to the test project folder.

Jasmine loads its test in an HTML file called a SpecRunner (short for specifications runner). This page loads the main Jasmine library, as well as all the user libraries and unit tests. Once loaded, the Jasmine library runs tests in the browser and displays the results.

Writing tests for Jasmine

Once we have the SpecRunner in place, it's time to write tests. Tests are written using normal JavaScript logic and a few testing objects and methods provided by Jasmine. Let's look at some of the different parts.

Writing suites, specs, and tests

Jasmine tests are organized by suites, specs, and tests. Suites make up the top level, and describe the unit tested...