Which version of Jasmine is integrated in Sencha Test?
Jasmine 2.4.1 is included in Sencha Test. Tests written to Jasmine 2.x will most likely work but Jasmine 1.x tests may have some issues due to Jasmine changes between 1.x and 2.x.
Sencha Test will automatically load all *.js files in a specified directory (what we call the Scenario) so the only issue I can foresee there is file order potentially. This would be a poorly written test perhaps but it could happen if they controlled the order manually. Other then that I don't see any reason the tests themselves won't work.
Setup PhantomJS for automate testing
All your Jasmine TDD tests you can automate with PhantomJS.
This blog post will tell you how to setup your environment for automated testing with PhantomJS.
You should have a local webserver running. It it might be handy to have Jasmine already up and go.
Please see my post: http://www.leeboonstra.com/developer/environment/setup-jasmine-tdd-with-for-ext-js/
You can download it for MAC & Windows from: http://phantomjs.org/download.html
- Windows users can run the exe file.
- Mac OSX users can run bin/phantomjs
But make sure you add phantomjs to your paths.
For Mac users, you can also install PhantomJS with homebrew.
To get homebrew you will need to have Ruby installed.
Use the following commands on your terminal:
whoami (it will prompt ur username: for example lee)
sudo chown lee:staff /usr/local
sudo chmod 0777 /usr/local
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
Now that you have brew on your Mac, you can use the following command to install PhantomJS:
brew update && brew install phantomjs
After everything is installed, you should type the following command in your command/terminal.
When everything is correctly installed it should output you the version number of PhantomJS!
Setup Jasmine TDD with for Ext JS
Download Jasmine standalone: https://github.com/pivotal/jasmine/downloads
In your ExtJS project folder create a folder: app-test and place it next to the app folder.
In your Ext JS app-test folder, create the following file: app-test.js
(make sure it stands next to the app.js file.)
Unzip the Jasmine download. Copy the lib folder (which contains jasmine-1.x.x folder) into app-test.
Create in your project folder the file: index-test.html
With the following markup:
< !DOCTYPE HTML>
<link rel="stylesheet" type="text/css" href="app-test/lib/jasmine-1.3.1/jasmine.css">
<!-- include specs here -->
<!-- test launcher -->
EDITED: Due, to issues with the wordpress editor, please see:
(I'm using Jasmine version 1.3.1) If you are using a different version, please make sure the framework files are correctly linked.
- Now open your browser and navigate to the index-test.html page.
If everything is correctly installed; you should see a test pass page with: 0 specs, 0 failures in 0s.
You're ready to create your TDD tests.
Read more in the following blogpost: