0% found this document useful (0 votes)
50 views13 pages

Jasmine Testing

Uploaded by

anuproyal24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views13 pages

Jasmine Testing

Uploaded by

anuproyal24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Simple

JavaScript
testing
•Jasmine is a powerful open-source
unit testing behavior-driven
development framework for
JavaScript and has the capability for
testing any kind of JavaScript
COMP-311 Software Testing & application. It has been around since
Quality 2010. It can test both synchronous
Berkay Gezbeli – 301428408 and asynchronous JavaScript code. It
Dhruvesh Solanki – 301452856 is independent of any other
Vaishnavi Kandoi – 301413919 JavaScript framework. Jasmine tool is
mainly used by Angular developers,
it is because Jasmine is included
natively in Angular projects.
Overview

FAST NO NODE
MAGIC AND
Low overhead, Jasmine specs are BROWSE
Run your browser
jasmine-core has no just JavaScript. tests and Node.js
external Jasmine doesn't R
tests with the same
dependencies. change the way your framework.
code loads or runs.
Advantages

• CLEAN
• USED TO MANAGE & CONTROL TEST-SCRIPTS
• EASY TO UNDERSTAND
• NO OTHER JS FRAMEWORK DEPENDENCY
• NO DEPENDENCY ON DOM
• ASYNCHRONOUS SUPPORT
• NO OTHER JS FRAMEWORK DEPENDENCY
BLOCKS

`describe`
describe("A group of related tests", function() {

});
BLOCKS

`it`
it(“should do something", function() {

});
BLOCKS

`expect`
expect(actualValue).toBe(expectValue);
BLOCKS

`beforeEach`
beforeEach(function() {

});
BLOCKS

`afterEach`
afterEach(function() {

});
EXAMPLE

function add(a, b) {
return a + b;
}
EXAMPLE

describe("Addition function", function() {


it("should return the sum of two numbers", funct
{ expect(add(2, 3)).toBe(5);
});
});
Disadvantages

• IT REQUIRES PLENTY OF CONFIGURATIONS


• THE USER WHO USES THE JASMINE TOOL MUST SELECT
AN ASSERTION LIBRARY OR A MOCKING FRAMEWORK
BEFORE USING IT.
• JASMINE JS CAN BE SLOWER COMPARED TO OTHER
FRAMEWORK, ESPECIALLY WHEN DEALING WITH LARGE
TEST SUITES.
Conclusion

Jasmine is a robust testing framework that comes with built-in


mocking and assertions, but the learning process is higher, and it
can be lengthy at times. It might not work as well with modern tools
and ES6+ features as more recent frameworks like Mocha or Jest.
THANK YOU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy