• Register
100 points
4

Want to solve programming problems and get paid for it? If that sounds interesting to you then contact us.

1. What is Karma and Jasmine?

Karma: Karma is a tool of running tests on browsers it lets us spawn browsers and run jasmine tests inside of them.

Jasmine: It is a testing framework for Javascript programming language that supports Behaviour Driven Development (BDD) software development practice.

2. How to define a Spec in Jasmine?

spec in Jasmine represents a test case inside the test suite. We can define spec by calling the global Jasmine function it, which, like describe takes a string and a function.

Example

describe("Suite Name", function() {
    it("test spec", function() {
        expect( expression ).toEqual(true);
    });
});

3. Enlist major matchers available in Jasmine?

toBeArray(), toBeArrayOfBooleans(), toBeFalse(), toBeCalculable(), toBeOddNumber(), toBeEmptyObject(), any.after(date) are few built in matchers in Jasmine. For complete list of Jasmine Matchers please visit Github Jasmine Matchers List

4. What is a headless browser?

A headless browser, a browser without any kind of graphical user interface (GUI) provides computerized control of a web page in an environment alike to popular web browsers but is performed through a command-line interface or managing network communication. They are especially useful for examining web pages as they can render and understand HTML the very way a browser would, including styling components such as page layout, color, font selection and execution of JavaScript and AJAX which are usually not possible when using other testing methods.

5. Why Use Jasmine?

Following are the advantages of using Jasmine over other available JavaScript testing frameworks −

  • Jasmine does not depend on any other JavaScript framework.

  • Jasmine does not require any DOM.

  • All the syntax used in Jasmine framework is clean and obvious.

  • Jasmine is heavily influenced by Rspec, JS Spec, and Jspec.

  • Jasmine is an open-source framework and easily available in different versions like stand-alone, ruby gem, Node.js, etc.

6. How to Use Jasmine?

Jasmine is very easy to implement in any kind of development methodology. All you need to download is the standalone library files from the official website https://jasmine.github.io/ and implement the same in your application.

The detailed environment setup will be described in the next chapter named “Environment setup”. Once you successfully download and unzip the zip file, then you will find the following sub-folders inside that zip file.

SOURCES :

onlineinterviewquestions.com

tutorialspoint.com

100 points
4