Getting Jasmine and setting up the test environment
Before we start writing our unit test cases we need to set up an environment where our test cases can be executed to verify our implementation. In this recipe, we will show how this environment and necessary libraries can be set up for a visualization project.
Getting ready
Jasmine (https://jasmine.github.io/ ) is a Behavior-Driven Development (BDD) framework for testing JavaScript code.
Note
BDD is a software development technique that combines Test Driven Development (TDD) with domain driven design.
We chose Jasmine as our testing framework because of its popularity in JavaScript community as well as its nice BDD syntax. You can download the Jasmine library from, https://github.com/jasmine/jasmine/releases.
Once downloaded you need to unzip it into the lib
folder. Besides the lib
folder we also need to create the src
and spec
folders for storing source files as well as test cases (in BDD terminology, test cases are called specification...