Prev Next

Testing / Jasmine Interview Questions

Explain Setup and teardown in Jasmine.

beforeAll: This function is called once, before all the specs in describe test suite are run.

afterAll: This function is called once after all the specs in a test suite are finished.

beforeEach: This function is called before each test specification, it function, has been run.

afterEach: This function is called after each test specification has been run.

describe('Hello world', () => {

  let expected = "";

  beforeEach(() => {
    expected = "Hello World";
  });

  afterEach(() => {
    expected = "";
  });

  it('says hello', () => {
    expect(message())
        .toEqual(expected);
  });
});

More Related questions...

Show more question and Answers...


Comments & Discussions