Search Tutorials


Jasmine (2025) Interview Questions | JavaInUse

Jasmine Interview Questions


In this post we will look at Jasmine Interview questions. Examples are provided with explanation.


  1. What is Angular Unit Testing?
  2. What is Jasmine?
  3. What are the types of Matchers used in Jasmine?
  4. What is a Headless Browser?
  5. Name some Asymmetric Matchers in Jasmine?
  6. How can we disable tests in Jasmine?
  7. What is Jasmine Spy?
  8. How can we focus on a single Spec in Jasmine.js?
  9. How do we change the return value of Jasmine Spy?

What is Angular Unit Testing?

Angular Unit Testing is a testing used in testing individual components of the applications.It is performed by using Karma and Jasmine.
Jasmine is used in writing the tests and Karma is used in running those tests.We can use Async and TestBed in testing Asynchronous Code, Components, Directives and Service easier.

What is Jasmine?

Jasmine is used as a testing tool for unit testing and is one of the most significant types of Automated Testing.It also comes to the web apps, in testing our plans consisting end-to-end testing, load, and user interface testing.

What are the types of Matchers used in Jasmine?

Matchers used in Jasmine are as follows:
toBeArray()
toBeArrayOfBooleans()
toBeFalse()
toBeCalculable()
toBeOddNumber()
toBeEmptyObject()
any.after(n)

What is a Headless Browser?

Headless Browser is used in providing computerized control of a web page in a popular web browser and is performed through CLI(Command Line Interface) or in managing network communication.It is also used for examining web pages as it renders and understands HTML and consists of components like Page Layout, Color, Font Selection and in executing JavaScript and AJAX.

Name some Asymmetric Matchers in Jasmine?

Some of the Asymmetric Matchers in Jasmine are as follows:
jasmine.any
jasmine.anything
jasmine.arrayContaining
jasmine.objectContaining
jasmine.stringMatching




How can we disable tests in Jasmine?

We can disable tests by using the following Command:
xdescribe('Hello', () => { (1)
  xit('says Hello', () => { (1)
    expect(Hello())
        .toEqual('Hello!');
  });
});


What is Jasmine Spy?

Jasmine Spy allows in spying on our application functions.There are two types of spy technologies:
spyon() - helps by allowing us to spy on a specific piece of code.
createSpy - helps by allowing us to spy on the functionality.

How can we focus on a single in Jasmine.js?

We can run a single spec by using the url given below:
describe("myspec", function() { it('function 3', function() { //... }) it('function 4', function() { //... } })

How do we change return value of Jasmine Spy?

We can change the return value by using the command:
authService.currentUser.and.returnValue('new');




See Also

Spring Boot Interview Questions Apache Camel Interview Questions Drools Interview Questions Java 8 Interview Questions Enterprise Service Bus- ESB Interview Questions. JBoss Fuse Interview Questions Top ElasticSearch frequently asked interview questions