Duration of the online course: 8 hours and 45 minutes
New
Build real JavaScript unit-testing skills with a free Jasmine course—write specs, use matchers and spies, automate runs with Karma, and earn confidence shipping code.
In this free course, learn about
Why unit testing matters and why Jasmine is used for JavaScript unit tests
Build a calculator UI, parse inputs, switch on operators, and update DOM results/errors
Install/run Jasmine standalone; use SpecRunner.html to view browser test results
Jasmine structure: describe() suites, it() specs, expectations via expect()
How specs pass/fail and how to disable specs/suites (xit/xdescribe) to mark pending
Core matchers: toBe vs toEqual, truthy/falsy, undefined/null, contain, NaN, match
Error testing: toThrow/toThrowError and writing expectations for thrown exceptions
Create and use custom matchers (must return a compare() result with pass/message)
Organize/nest suites and use lifecycle hooks: beforeEach/afterEach/beforeAll/afterAll
Use spies/test doubles: spyOn, spy matchers, callThrough/callFake/returnValue(s)/throwError
Spy on prototypes and properties (spyOnProperty) incl. getters/setters and defineProperty
Test async code with Promises, done callback, async/await; mock fetch to avoid real calls
Run tests with npm + Karma, headless Chrome (Puppeteer), and generate coverage reports
About the free online course
Reliable software is rarely an accident. It is the result of small decisions made every day: validating logic before it reaches production, catching regressions early, and turning bug reports into repeatable tests. This free online course helps you build that mindset by learning Jasmine, one of the most practical frameworks for unit testing JavaScript applications. Instead of staying in theory, you will follow a hands-on path that mirrors real development work, so testing feels like an integral part of coding rather than an extra task.
You will start by clarifying what unit testing actually is and why Jasmine fits so well for JavaScript projects. From there, the course uses a simple calculator app as a realistic practice project: first building behavior and UI interactions, then tightening the code with better error handling and DOM updates. This context makes each testing concept immediately meaningful, because you can see how a test protects the features you just implemented.
As you progress, you will learn how Jasmine organizes tests with suites and specs, how naming conventions affect discoverability, and how expectations translate business rules into clear assertions. You will become comfortable choosing matchers for different situations, understanding the difference between strict identity and deep equality, working with truthy and falsy values, negating conditions, and handling edge cases like undefined, null, NaN, and thrown errors. You will also explore asymmetric matchers and create custom matchers so your tests read naturally and stay maintainable as requirements evolve.
The course then moves into the techniques that make unit tests powerful in modern codebases: setup and teardown lifecycle hooks, nested organization for clarity, and effective use of context within specs. You will practice test doubles through Jasmine spies, learning when to observe behavior, when to stub responses, how to validate call counts and arguments, and how to swap in custom implementations safely. You will also see how to handle properties, getters and setters, and how to test asynchronous behavior with Promises, done callbacks, and async/await without relying on flaky real network calls.
Finally, you will connect your tests to a more professional workflow by installing Jasmine with npm and running suites with Karma in a headless browser environment. With automated execution and coverage reporting, you will be equipped to integrate unit tests into everyday development and CI pipelines. By the end, you will have practical, job-relevant confidence to write readable tests, debug failing specs quickly, and ship JavaScript features with far less risk.
Course content
Video class: 1. Why Jasmine for Unit Testing. Introduction to Jasmine Framework for JavaScript Applications.10m
Exercise: What is unit testing?
Video class: 2. Create Simple Calculator Program08m
Video class: 3. Build the Calculator Program UI and capture the input value from the Textbox - Jasmine Testing08m
Video class: 4. Extract numbers09m
Video class: 5. Calculate the result using switch case and update the result in the DOM - Jasmine Testing08m
Exercise: In the simple calculator, which structure is used to choose the correct operation based on the operator (+, -, *, /)?
Video class: 6. Improving Errors for the Calculator and update the error message in the DOM - Jasmine Testing08m
Video class: 7. Setup Jasmine Testing Framework for Unit Testing in the Calculator program - Jasmine Testing09m
Exercise: After installing Jasmine as a standalone, which file should you open to view the test results in the browser?
Video class: 8. Understanding the Testing File Naming Conventions and the concept of Suite in Jasmine Testing08m
Video class: 9. Create our Test Suite in the calculator spec file using describe method - Jasmine Testing06m
Exercise: In Jasmine, which function is used to create a test suite (a group of specs/tests)?
Video class: 10. Write first Spec in the Test Suite for Calculator Spec file - Jasmine Testing08m
Video class: 11. What is Expectations in Testing and write expectation in spec file using expect method - Jasmine08m
Exercise: In Jasmine, what does an expectation represent?
Video class: 12. Passing and Failing Specs. When can we say a spec is passed and failed - Jasmine Testing08m
Video class: 13. How to make a Spec or Suite to Disabled Spec and Disabled Suite in Jasmine Testing Framework08m
Exercise: In Jasmine, what is the correct way to disable a single spec so it shows as pending and is not executed?
Video class: 14. What are Matchers? Why we use matchers for expectations in Jasmine Testing Framework.08m
Video class: 15. Learn toBe Matcher in Jasmine Unit Testing Framework - JavaScript Testing09m
Exercise: In Jasmine, what does the matcher expect(actual).toBe(expected) primarily check?
Video class: 16. Understand toEqual Matcher. Difference between toBe09m
Video class: 17. ToBeTruthy and tobeFalsy Matcher and the difference between them - Jasmine Testing08m
Exercise: Which Jasmine matcher should you use to verify that a value evaluates to false in a boolean context (e.g., 0, "", null, undefined, NaN)?
Video class: 18. Negating Matcher. Invert the matchers using Not in Jasmine Testing04m
Video class: 19. toBeUndefined and toBeDefined Matchers. When to use these matchers in Jasmine Testing Framework.08m
Exercise: In Jasmine, what does the matcher toBeUndefined() check?
Video class: 20. Understand toBeNull Matcher - Jasmine Testing Framework05m
Video class: 21. toContain Matcher to find element in an array or substring in a string - Jasmine Testing07m
Exercise: In Jasmine, what does the toContain matcher verify?
Video class: 22. toBeNaN Matcher to find the value whether it is NaN or not - Jasmine Testing Framework08m
Video class: 23. Learn toThrow matcher to check whether the function throw something - Jasmine Testing08m
Exercise: How do you correctly use Jasmine's toThrow matcher to test that divide(0) throws an error?
Video class: 24. toThrowError Matcher and the difference between toThrow and toThrowError - Jasmine Testing08m
Video class: 25. toMatch Matcher for matching the actual data using regular expression - Jasmine Testing08m
Video class: 26. Asymmetric Matcher anything. When to use06m
Video class: 27. Asymmetric Matcher Jasmine.any. Difference between anything and any matchers05m
Video class: 28. Jasmine ObjectContaining and StringContaining asymmetric matchers - Jasmine Testing05m
Video class: 29. What is Custom Matcher. How to create our own matcher08m
Exercise: In Jasmine, what must a custom matcher method return to be valid?
Video class: 30. Practical implementation of the Custom Matchers and use it in our Spec file - Jasmine Testing10m
Video class: 31. List of Recommendations for organizing Specs in JavaScript Testing - Jasmine Testing05m
Exercise: In Jasmine, what is the purpose of using the describe() method when organizing specs?
Video class: 32. Nested Suites | Write Nested Suites using describe in JavaScript testing | Jasmine Testing10m
Video class: 33. Setup and Teardown Life cycle Methods for Suites in JavaScript Testing - Jasmine Testing07m
Exercise: In Jasmine, which pair of methods belongs to the setup phase (runs before specs) within a suite lifecycle?
Video class: 34. Implementation of beforeEach and afterEach methods in the Test Suite - Jasmine Testing08m
Video class: 35. Implement main.js spec file10m
Exercise: Why was main.spec.js not showing up in the Jasmine runner output at first?
Video class: 36. Implement beforeAll and afterAll lifecycle methods in main spec file - Jasmine Testing08m
Video class: 37. Use of this keyword in Jasmine Testing. How to use the this in specs - Jasmine Testing05m
Video class: 38. Jasmine Spies and Why we need to use the spies in Unit Testing - Jasmine Testing09m
Video class: 39. What are Jasmine Spies and Test doubles. Different Spy Matchers available in Jasmine Testing.08m
Exercise: In Jasmine, what is the main purpose of using a spy (test double)?
Video class: 40. Spying and stubbing on the functions in the spec file using spyOn Method - Jasmine Testing08m
Video class: 41. Usage of toHaveBeenCalled spy matcher in Spec file For Jasmine Spies - Jasmine Testing08m
Exercise: Which Jasmine spy matcher is used to verify that the updateResult method was invoked during calculate() execution for an invalid expression?
Video class: 42. toHaveBeenCalledWith Matcher in Jasmine Spies - Jasmine Testing05m
Video class: 43. toHaveBeenCalledTimes Matcher in Jasmine Spies - Jasmine Testing05m
Exercise: Which Jasmine spy matcher is used to verify how many times a function (e.g., updateResult) was called?
Video class: 44. Spying on the prototypes using spyOn method - Jasmine Testing09m
Video class: 45. Spying on the methods multiply, divide and subtract calculator prototypes - Jasmine Testing08m
Exercise: When spying on calculator prototype methods for operations (add/subtract/multiply/divide), which argument should the spy expect the operation method to be called with?
Video class: 46. Call the implementation of the spy function using callThrough - Jasmine Testing09m
Video class: 47. call customized functionality for a spy method using callFake - Jasmine Testing04m
Exercise: In Jasmine, what does callFake do when used with a spy on a method?
Video class: 48. Return a single value with the spy using returnValue configuration method - Jasmine Testing04m
Video class: 49. Return Multiple values with the spy method for every call using returnValues - Jasmine Testing07m
Exercise: In Jasmine spies, what is the main purpose of using returnValues() instead of returnValue()?
Video class: 50. throwError config method to send error when a spy method is called - Jasmine Testing05m
Video class: 51. Create new getter property in calculator object using Object defineProperty - Jasmine Testing09m
Exercise: Which statement best describes how Jasmine's spyOn behaves with getter properties?
Video class: 52. Show version number in the calculator UI from the calculator getter property - Jasmine Testing06m
Video class: 53. Implement the Version Test Case by spying on the document getElementById - Jasmine Testing09m
Video class: 54. Spy on the getter and setter properties using spyOnProperty method - Jasmine Testing09m
Video class: 55. Asynchronous call with Fetch method to get version from api url using Promises - Jasmine Testing08m
Exercise: When implementing an asynchronous getter for a calculator version using fetch, why is .then() used when accessing calculator.version?
Video class: 56. Create Specs for Asynchronous calls using done callback for handling promises - Jasmine Testing08m
Video class: 57. Create Spy on the api Fetch call to avoid making real call while testing - Jasmine Testing08m
Exercise: In Jasmine, why is the done callback recommended when testing asynchronous code that returns a Promise?
Video class: 58. Testing JavaScript async and await calls - Jasmine Testing04m
Video class: 59. Initialize the npm package and create package.json file in calculator app - Jasmine Testing08m
Exercise: Why install Jasmine as an npm package instead of adding many source and spec files manually in specRunner.html?
Video class: 60. Understand Karma Test Runner Tool for automating tests in Jasmine Testing application09m
Video class: 61. Install the Karma Runner and Jasmine as dev dependencies in the application - Jasmine Testing08m
Exercise: Why is Karma used as a test runner in this setup?
Video class: 62. Create Karma Configuration file, karma.config.js for running Tests in app - Jasmine Testing10m
Video class: 63. Install Puppeteer for adding Chrome Headless browser in the karma config file - Jasmine Testing09m
Exercise: What is the main purpose of using the Karma Chrome Launcher (and ChromeHeadless) when running tests?
Video class: 64. Add coverage Reports using karma-coverage plugin in the Karma application - Jasmine Testing10m
Video class: 65. Completing Jasmine Testing Course. Recap the Concepts that we have covered in this Course09m
This free course includes:
8 hours and 45 minutes of online video course
Digital certificate of course completion (Free)
Exercises to train your knowledge
100% free, from content to certificate
Ready to get started?Download the app and get started today.