Site icon TestingDocs.com

Jasmine : A Behavior Driven Javascript Framework

Overview

Jasmine is a behavior-driven testing Javascript framework. It supports testing for synchronous and asynchronous JavaScript code. It’s opensource and developed by Pivotal Labs. The official website for the framework is: https://jasmine.github.io/

 

 

It does not depend on any other JavaScript frameworks. It does not require a DOM.  Tests written in Jasmine are clean, obvious syntax so that you can easily write tests and understand them.

There are various supported platforms of Jasmine framework. Some of them are as follows :

Jasmine standalone

Jasmine for Ruby

Jasmine for Python

Jasmine for Node.js

describe, it and expect:

A sample Jasmine test is shown in the picture for easy understanding.

 

 

The most commonly used keywords in Jasmine framework are describe, it and expect.

describe: In Jasmine framework, the test suite begins with a call to the Jasmine global function describe. It contains the function that implements the test suite.

it: A spec represents a test case in normal terminology. In Jasmine framework, a test case begins with a call to it. The it contains the function that implements a test case.

expect: A spec may contain one or more expectations. An expectation represents an assertion that can be true or false for verification of specs.

Exit mobile version