Skip to content

Jasmine FAQ (Unit Testing)

htsungwing edited this page Feb 2, 2016 · 16 revisions

Unit Testing with Jasmine

### Background Overview Jasmine is developed by Pivotal Labs and was once named JsUnit. Eventually it is transformed to the known Jasmine Framework. Jasmine is excellent for JavaScript testing and only require a JS enabled browser along with the Jasmine script. It uses testing suites where testing results are compared with expected values. A set of predefined matchers can be called to test the system. The framework can be downloaded from GitHub along with a page of instruction that guides a user to understanding how to run tests in your JavaScript supported browser.

I'm implementing a page in Aurelia? What can I test? What should I test?

Do I need to use setup or teardown to setup or destroy any state?

Most of the behavior that I want to test depends on data loaded from Firebase in the cloud. How do I test this?

I'm writing some functionality in a new JS file. Is there a convention on where I should put the corresponding tests in the file structure?

I wrote some tests. How do I run them?

What is a Spy, and when should I use it?

Where can I learn more about Jasmine?

Source

  1. History/Background (http://www.htmlgoodies.com/beyond/javascript/testing-javascript-using-the-jasmine-framework.html)

Clone this wiki locally