Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a Document Object Model (DOM), and it has a clean, obvious syntax so that you can easily write tests.
Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a Document Object Model (DOM), and it has a clean, obvious syntax so that you can easily write tests.
If you want to stand out as a JavaScript developer, you need to learn how to unit test your code. Jasmine is a great way to do so.
By the end of watching this course, you'll be able to:
Understand what unit testing is and why it is important in today's market.
Set up jasmine from scratch.
Write clean and concise suites, specs, and specifications.
Understand and use all of the out-of-the-box jasmine matchers, create your custom ones, and include them in your project.
Isolate dependencies through test-doubles, known as spies in Jasmine, for true unit testing.
Unit test asynchronous code.
Setup test reports and continuous integration from version control to automate your test runs.
Apply best practices when structuring your tests.
With this course, you'll get downloadable source code, slides, and section notes.
No previous unit testing experience is needed, just basic familiarity with JavaScript, HTML, and CSS (just optional when building our course project).
You don't need previous experience with a testing framework at all. We've got you covered.
Promo video music license:
Adventures by A Himitsu - Creative Commons — Attribution 3.0 Unported— CC BY 3.0 Music released by Argofox - Music provided by Audio Library
Here we explore the full course outline.
Here we explore the importance of unit testing and why Jasmine as your testing framework is a great choice.
Here we write our first spec using jasmine, from scratch!
Recap of what we learned in this section.
Downloadable materials for this section.
Overview of the content for this section.
Explore the project we will build and that we will unit test throughout this course.
Build the course project base functionality.
Program the user interface to interact with the core functionality we previously built so the project is usable.
Enhance the error handling for our application.
Make our application more attractive to the user and improve user experience.
Manually set up jasmine from the main jasmine repository.
Explore what suites are, and how to implement them, to test our application.
Understand what specs are, how to use them and we will write the first specs that test our application.
Learn about expectations and write our own to assert our code.
In this lecture we are going to learn how to disable suits and specs, and why is this useful.
Downloadable materials of this section.
Learn what a matcher is, and how to use them.
Learn about the toBe matcher and use it to test your code.
Learn how to use the toEqual matcher and use it to test our code.
Learn how to use the toBeTruthy, and toBeFalsy matchers, why they are important and use them to test our code.
Learn how to negate the different matchers and use this to test our code.
Learn about the toBeDefined, and the toBeUndefined matchers, and use them to test your code.
Learn about the toBeNull matcher, and use it to test your code.
Learn about the toContain matcher, and use it to test your code.
In this lecture we will learn about the toBeNaN matcher, and use it to test our code.
Learn about the toThrow, and toThrowError matchers, and use it to test our code.
Learn about the toMatch matcher, and use it to test your code.
Learn about other matchers, and use it to test your code.
Explore asymmetric matchers and learn how to match anything.
Create our own custom matchers to fit the needs of our code.
Explore the different matchers from third-party sources.
Recap what we learned in this section.
Overview of the content of this section.
Some recommendations and best practices to organize better your specs.
Explore how to nest our suites and why this is important.
Explore the different life cycle hooks that jasmine offers.
Learn about the beforeEach and the afterEach setup and teardown methods and use them in your suites.
Learn about the beforeAll, and the afterAll life cycles, and use them to test in your suites.
Learn about the this keyword, and the different context that it has in our suites.
Learn what spies are, why they are important and how to use them.
Explore the different functions that jasmine has to spy on our code.
Learn about the toHaveBeenCalled matcher, and use it to write assertions on spies.
Learn about the toHaveBeenCalledWith matcher, , and use it to write assertions on spies.
Learn about the toHaveBeenCalledTimes matcher, and use it to write assertions on spies.
Learn how to spy on JavaScript prototypes.
Learn about the spy method callThrough and use it to configure your spies.
Learn about callFake and use it to configure your spies.
Learn about the spy method returnValue and use it to configure your spies.
Learn about returnValues and use it to configure your spies.
Learn about throwError and use it to configure your spies.
In this lecture we implement a getter for our project.
Learn about how to test getters and setters with spyOnProperty
Use promises within our application.
The done callback provided by jasmine to test promises.
Your turn to work on a spec!
Solution for the exercise, and the logic behind it.
Async and await, we implement it in our application and show you how to test with them.
The package.json, how it works and how to generate one.
Install the different dependencies needed for the application.
Karma runner, the benefits and how to use it to automatize our tests.
What is a headless browser, and add one to our Karma runner.
What are coverage reports, how to read them and why are they important.
Push our code to version control.
Connect our repository to the CI system.
Create the manifest to build our project for the CI system.
Add a build badge for our README in our repository.
Explore what you should learn next to further improve your skills.
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.