Jasmine Testing
Jasmine Testing
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