Setting up Jasmine with ExtJS for Unit Testing - Getting Started

Getting Started

It's probably a good idea to read through the Sencha tutorial referenced on the prior page as background material.

Create the directories and install Jasmine

Create the app-test and and app-test/specs directory as mentioned in the tutorial.

Download and extract Jasmine into the app-test directory. This will add a lib, spec and src directory to app-test along with a SpecRunner.html file. We can for the most part ignore these.

app-test Directory

Create your spec runner file

Create a run-tests.html file in the project directory (parent directory of app-test) and cut and paste the following code:

    <title id="page-title">Jasmine Example</title>
    <link rel="stylesheet" type="text/css" href="app-test/lib/jasmine-1.3.1/jasmine.css">
    <script type="text/javascript" src="extjs/ext-debug.js"></script>
    <script type="text/javascript" src="app-test/lib/jasmine-1.3.1/jasmine.js"></script>
    <script type="text/javascript" src="app-test/lib/jasmine-1.3.1/jasmine-html.js"></script>

    <!-- include specs here -->
    <script type="text/javascript" src="app-test/specs/initial.js"></script>
    <!-- test launcher -->
    <script type="text/javascript" src="app-test.js"></script>


 Note that you may have to change the path of your extjs distribution.