What does "it()" stand for in Jasmine?

bdd, jasmine, javascript

Solution

It means "it", as in the word "it". As in the test declaration reads like a sentence. You `describe` an object by what `it` does. Simple as that.

For example:

Bowling ball is round

Bowling ball has 3 holes

Might translate to a test hierarchy like this:

Bowling Ball
  it is round
  it has three holes

Which would translate to the following testing setup:

describe(BowlingBall, function() {
  it('is round', function() {});
  it('has three holes', function() {});
});

So because it reads well, it just becomes the way you separate individual test cases. It also encourages you to write your test description in a consistent manner because `it` is part of the sentence that describes the test, which makes your test suite more readable over the long term.

In the end BDD is all about readability for the test writer. So this is simply sugar.

Problem

Just curious what the function name it() stands for in the Jasmine Javascript test framework. Does it stand for something like "independent test" or something?

Original source