Jasmine is a behavior-driven development framework (behavior driven) to test the JavaScript code. It does not depend on other JavaScript framework and does not require the DOM. It has a simple syntax so that you can easily write tests.

A test suite begins with a call to the global Jasmine describe, with two parameters: a string and a function. The string is a name or a title for a specific suite, usually the one to be tested. The function is a block of code that implements the suite.

describe("A suite", function() {
     it("contains spec with an expectation", function() {

The specifications are defined by calling the global function of Jasmine it, which, as describe takes a string and a function. The string is a title for this specific feature is the specification, or test. A specification contains one or more expectation that test the status of the code under test.
Jasmine is an expectation of an assertion that can be true or false. A specification with all real expectation is a correct specification. With a specific one or more expectation that return false is an incorrect specification.

describe("The 'toBe' matcher compares with ===", function() {
    it("and has a positive case ", function() {

The function describe used to gather the relevant specifications. The string parameter is used to name the collection of specifications, and the specifications will be concatenated to make his full name. This helps you find the specifications in a large suite.

Jasmine is done in JavaScript and is inserted into a JS environment, such as a web page, in order to run the tests. The JavaScript file is then included via script tag, so that all specifications mentioned above are measured and recorded. Creates the HtmlReporter, so that Jasmine provides the results of each specification and each suite.

Jasmine site

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page