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
WEB APP TESTING USING KNOCKOUT.JS

You're reading from   WEB APP TESTING USING KNOCKOUT.JS Design, implement, and maintain a fully tested JavaScript web application using Knockout.JS

Arrow left icon
Product type Paperback
Published in Nov 2014
Publisher
ISBN-13 9781783982844
Length 154 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Roberto Messora Roberto Messora
Author Profile Icon Roberto Messora
Roberto Messora
Arrow right icon
View More author details
Toc

Hello Jasmine


Working with Jasmine is quite easy. We have to perform the following steps:

  1. Download Jasmine 2.0 as a ZIP file from its hosting website on Github (https://github.com/pivotal/jasmine/tree/master/dist).

  2. Create a folder for the test project.

  3. Unzip the Jasmine package inside the folder created in step 2.

  4. Empty the spec and src subfolders deleting the example files.

  5. Add some source code to be tested in the src subfolder as .js files.

  6. Add some testing code using Jasmine in the spec subfolder as .js files.

  7. Add script references to the files added in steps 5 and 6 to the special file, SpecRunner.html.

  8. Open SpecRunner.html in a web browser to run the tests and verify the results.

This is clearly not a typical TDD coding cycle. We first write some code and then we test it. TDD suggests the exact opposite. I'm a great TDD supporter, but I want to keep things here as simple as possible and explain Jasmine even to those who do not know TDD.

For example, in step 5, we can add the following JavaScript...

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