1.
What's Jasmine?
Correct Answer
A. An open source framework
Explanation
Jasmine is an open source framework used for testing JavaScript code. It provides a behavior-driven development (BDD) style syntax, making it easier to write and read test cases. With Jasmine, developers can define test suites and individual test cases, and then run those tests to ensure that their code is functioning as expected. Being an open source framework means that it is freely available for anyone to use and contribute to its development.
2.
When was Jasmine initially released?
Correct Answer
C. In 2010
3.
Which platform does Jasmine work on?
Correct Answer
D. JavaScript
Explanation
Jasmine works on the JavaScript platform.
4.
Which statement about Jasmine is true?
Correct Answer
A. Jasmine supports asynchronous testing
Explanation
Jasmine supports asynchronous testing, which means it can handle code that involves asynchronous operations like callbacks, promises, and async/await. This allows developers to write tests for code that involves asynchronous behavior, ensuring that the code functions correctly even with delays or dependencies on external resources. Asynchronous testing is an important feature for modern applications that rely heavily on asynchronous programming patterns.
5.
What does Jasmine use spies for?
Correct Answer
D. implementing test doubles
Explanation
Jasmine uses spies for implementing test doubles. Test doubles are objects or functions that are used in place of real dependencies during testing. Spies in Jasmine allow developers to create test doubles that can track calls, return values, and more. By implementing test doubles using spies, developers can simulate the behavior of real dependencies and test the functionality of their code in isolation.
6.
What's Jasmine's front-end extension called?
Correct Answer
B. Jasmine-jQuery
Explanation
Jasmine-jQuery is the correct answer because it is a popular extension for the Jasmine testing framework that allows developers to use jQuery syntax and methods in their test suites. This extension provides additional functionality and makes it easier to test code that interacts with the DOM or uses jQuery for event handling, animations, and other tasks.
7.
Which one of these runs Jasmine tests?
Correct Answer
B. Karma
Explanation
Karma is the correct answer because it is a popular test runner specifically designed for running Jasmine tests. It provides a simple and efficient way to execute tests and generate test reports. Karma also supports various browsers and platforms, making it a versatile tool for testing JavaScript code.
8.
What has Jasmine built into it?
Correct Answer
C. Assertions
Explanation
Jasmine, in this context, refers to a software testing framework. Assertions are a fundamental component of testing frameworks as they allow developers to define expected outcomes and compare them with the actual results of their code. Therefore, it can be inferred that Jasmine has assertions built into it to facilitate the testing process.
9.
Which one of these Jasmine doesn't have?
Correct Answer
A. A command line utility to run tests
Explanation
Jasmine does not have a command line utility to run tests. This means that Jasmine does not provide a built-in tool or feature that allows users to execute their tests from the command line interface. Users may need to use other testing frameworks or tools to run Jasmine tests from the command line.
10.
Which feature does Jasmine have?
Correct Answer
D. Custom matchers
Explanation
Jasmine has the feature of custom matchers. This means that it allows users to define their own matchers, which are used to compare the actual value with the expected value in test cases. Custom matchers provide flexibility and allow developers to write more expressive and readable tests by creating matchers specific to their application's needs.