Difference between revisions of "Jasmine (JavaScript testing framework)"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
Line 51: Line 51:
 
* [https://evanhahn.com/how-do-i-jasmine/ How do I Jasmine: a tutorial] by Evan Hahn
 
* [https://evanhahn.com/how-do-i-jasmine/ How do I Jasmine: a tutorial] by Evan Hahn
 
* [https://inviqa.com/blog/testing-javascript-get-started-jasmine-0 Testing Javascript: get started with Jasmine] by Katie Fenn
 
* [https://inviqa.com/blog/testing-javascript-get-started-jasmine-0 Testing Javascript: get started with Jasmine] by Katie Fenn
 +
* [http://blog.adamcameron.me/2014/12/javascript-jasmine-for-unit-testing.html JavaScript: Jasmine for unit testing] by Adam Cameron
 +
* [http://www.slideshare.net/lporras161/jasmine-bdd-for-javascript Jasmine BDD for Javascript] by
 +
Luis Alfredo Porras Páez
 +
* [http://blog.carbonfive.com/2011/07/06/pragmatic-javascript-testing-with-jasmine/ Pragmatic JavaScript Testing with Jasmine] by Jared Carroll
 +
* [https://www.rainforestqa.com/blog/2014-07-14-test-your-javascript-with-jasmine-the-basics-part-1/ Test your JavaScript with Jasmine part 1] by Jean Philippe Boily
 +
* [http://howtodoinjava.com/scripting/javascript/jasmine-javascript-unit-testing-tutorial/ Jasmine – JavaScript Unit Testing Tutorial with Examples] by Lokesh Gupta
 +
* [https://kroltech.com/2013/11/20/javascript-tdd-with-jasmine-and-karma/ JavaScript TDD with Jasmine and Karma] by Krol Tech
 +
* [http://www.developer.com/lang/jscript/testing-javascript-code-with-jasmine.html Testing JavaScript Code with Jasmine] Jason Gilmore
 +
* [https://vimeo.com/71326996 JavaScript Testing with Jasmine] by Codeship
 +
* [http://blog.jphpsf.com/2012/08/30/drying-up-your-javascript-jasmine-tests DRYing Up Your JavaScript Jasmine Tests With the Data Provider Pattern] by JP
 +
* [https://www.joezimjs.com/javascript/javascript-unit-testing-with-jasmine-part-1/ JavaScript Unit Testing With Jasmine: Part 1] by Joe Zim+
 +
* [http://ivanjovanovic.com/2011/07/22/introduction-to-javascript-bdd-testing-with-jasmine-library/ Introduction to JavaScript BDD Testing With Jasmine Library] by Ivan Jovanovic
 +
* [http://www.codeproject.com/Articles/1118021/Jasmine-Testing-JavaScript Jasmine - Testing JavaScript] by Sharon Sudhan
 +
* [http://geniuscarrier.com/jasmine-javascript-testing/ Jasmine - JavaScript Testing] by Yang Zhao
 +
 +
=== General principles of testing ==
 +
 +
* [http://www.adequatelygood.com/Writing-Testable-JavaScript.html http://www.adequatelygood.com/Writing-Testable-JavaScript.html]
 +
 +
=== Online tools ===
 +
 +
* [http://tryjasmine.com/ Try Jasmine]]
  
 
=== YouTube videos ===
 
=== YouTube videos ===

Revision as of 11:05, 25 September 2016

Jasmine is an open source unit testing framework for testing JavaScript code.

It uses the behavior-driven development model.

Description

It aims to run on any JavaScript-enabled platform, to not intrude on the application nor the IDE, and to have easy-to-read syntax.

Jasmine has a number of other features, such as custom matchers, spies, and support for asynchronous specifications.

Examples

A simple hello world test looks like the code below, where describe() describes a suite of tests and it() is an individual test specification.

The name "it()" follows the idea of behavior-driven development and serves as the first word in the test name, which should be a complete sentence.

The code below tests this function:

function helloWorld() {
  return 'Hello world!';
}

and verifies that its output is indeed the text "Hello world!".

describe('Hello world', function() {
  it('says hello', function() {
    expect(helloWorld()).toEqual('Hello world!');
  });
});

Influences

It is heavily influenced by other unit testing frameworks, such as ScrewUnit, JSSpec, JSpec, and RSpec.

See also

External links

Luis Alfredo Porras Páez

= General principles of testing

Online tools

YouTube videos