Unit Testing in JavaScript: SinonJS
Unit Testing
| Intermediate
- 23 videos | 2h 28m 1s
- Includes Assessment
- Earns a Badge
Learners can explore the Sinon JS (Javascript) library in this 23-video course. You will learn how to install Sinon library, and will explore the use of fakes, spies, stubs, and mocks in Sinon. Observe how to test code that is part of your application, and replace invocations to other components by using fix. You will learn to create a fake function, and to define the behavior of these functions. Next, you will examine spies, which support all operations that fake support, and allow you to spy on methods that you invoke on objects. Learners continue by examining how stubs can be used to create objects without invoking the objects constructor, and how configuring stub behavior allows us to test specific code paths. You will learn to use fake timers and sandboxes to write unit tests, and how to configure fakes and spies with behavior. Finally, you will learn to set up the expectations for your mocks, and you will control time using fake timers for asynchronous operations which use promises in JS.
WHAT YOU WILL LEARN
-
Discover the key concepts covered in this courseInstall mocha and sinon on your local machineCreate an object to be used in test casesUse fakes to record function invocationsConfigure fakes with specific behaviorTest the order of function invocations using fakesRecognize how to test errors and callbacks with fakesPerform asynchronous tests using fakes with promisesCreate and use anonymous spies for testingWrap spies around existing functionsSpy on specific methods of an objectDescribe the use of sandboxes for testing
-
Perform testing using spies on object getters and settersTest real world components using spiesConfigure stub behavior in test casesCreate stubs for object methodsInstantiate objects without invoking object constructorsPerform testing using mocks and set expectationsUse spy calls to test function invocationsControl time in tests to make asynchronous testing easyUse fake timers with multiple async functionsUse sandboxes to simplify testingSummarize the key concepts covered in this course
IN THIS COURSE
-
2m
-
3m 59sIn this video, you will install Mocha and Sinon on your local machine. FREE ACCESS
-
4m 25sIn this video, you will create an object to be used in test cases. FREE ACCESS
-
7m 45sLearn how to use fakes to record function calls. FREE ACCESS
-
7m 12sIn this video, you will configure fakes with specific behavior. FREE ACCESS
-
8m 5sIn this video, you will test the order of function invocations using fake objects. FREE ACCESS
-
10m 3sUpon completion of this video, you will be able to recognize how to test errors and callbacks with fakes. FREE ACCESS
-
4m 24sIn this video, you will perform asynchronous tests using fakes with promises. FREE ACCESS
-
8m 55sIn this video, find out how to create and use anonymous spies for testing. FREE ACCESS
-
4m 13sIn this video, find out how to wrap existing functions in spies. FREE ACCESS
-
5m 23sIn this video, you will learn about spying on specific methods of an object. FREE ACCESS
-
5m 48sUpon completion of this video, you will be able to describe the use of sandboxes for testing purposes. FREE ACCESS
-
2m 10sIn this video, you will learn how to test using spies on object getters and setters. FREE ACCESS
-
5m 51sDuring this video, you will learn how to test real world components using test doubles. FREE ACCESS
-
10m 28sIn this video, you will configure stub behavior in test cases. FREE ACCESS
-
7m 36sIn this video, you will learn how to create stubs for object methods. FREE ACCESS
-
5m 43sIn this video, find out how to create objects without invoking object constructors. FREE ACCESS
-
8m 55sDuring this video, you will learn how to perform testing using mocks and setting expectations. FREE ACCESS
-
9m 32sDuring this video, you will learn how to use spy calls to test function invocations. FREE ACCESS
-
10m 1sLearn how to control time in tests to make asynchronous testing easier. FREE ACCESS
-
6m 13sFind out how to use fake timers with multiple async functions. FREE ACCESS
-
8m 3sIn this video, you will learn how to use sandboxes to simplify your testing. FREE ACCESS
-
1m 16sIn this video, we will summarize the key concepts covered in this course. FREE ACCESS
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.
Digital badges are yours to keep, forever.