Unit Testing in JavaScript: SinonJS

Unit Testing    |    Intermediate
  • 23 videos | 2h 28m 1s
  • Includes Assessment
  • Earns a Badge
Rating 4.3 of 4 users Rating 4.3 of 4 users (4)
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 course
    Install mocha and sinon on your local machine
    Create an object to be used in test cases
    Use fakes to record function invocations
    Configure fakes with specific behavior
    Test the order of function invocations using fakes
    Recognize how to test errors and callbacks with fakes
    Perform asynchronous tests using fakes with promises
    Create and use anonymous spies for testing
    Wrap spies around existing functions
    Spy on specific methods of an object
    Describe the use of sandboxes for testing
  • Perform testing using spies on object getters and setters
    Test real world components using spies
    Configure stub behavior in test cases
    Create stubs for object methods
    Instantiate objects without invoking object constructors
    Perform testing using mocks and set expectations
    Use spy calls to test function invocations
    Control time in tests to make asynchronous testing easy
    Use fake timers with multiple async functions
    Use sandboxes to simplify testing
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m
  • 3m 59s
    In this video, you will install Mocha and Sinon on your local machine. FREE ACCESS
  • Locked
    3.  Setting up the Object under Test
    4m 25s
    In this video, you will create an object to be used in test cases. FREE ACCESS
  • Locked
    4.  Using Fakes
    7m 45s
    Learn how to use fakes to record function calls. FREE ACCESS
  • Locked
    5.  Using Fakes with Behavior
    7m 12s
    In this video, you will configure fakes with specific behavior. FREE ACCESS
  • Locked
    6.  Testing the Order with Fakes
    8m 5s
    In this video, you will test the order of function invocations using fake objects. FREE ACCESS
  • Locked
    7.  Testing Errors and Callbacks with Fakes
    10m 3s
    Upon completion of this video, you will be able to recognize how to test errors and callbacks with fakes. FREE ACCESS
  • Locked
    8.  Using Fakes with Promises
    4m 24s
    In this video, you will perform asynchronous tests using fakes with promises. FREE ACCESS
  • Locked
    9.  Using Anonymous Spies for Testing
    8m 55s
    In this video, find out how to create and use anonymous spies for testing. FREE ACCESS
  • Locked
    10.  Wrapping Spies around Functions
    4m 13s
    In this video, find out how to wrap existing functions in spies. FREE ACCESS
  • Locked
    11.  Spying on Methods of an Object
    5m 23s
    In this video, you will learn about spying on specific methods of an object. FREE ACCESS
  • Locked
    12.  Using Sandboxes to Spy on Objects
    5m 48s
    Upon completion of this video, you will be able to describe the use of sandboxes for testing purposes. FREE ACCESS
  • Locked
    13.  Spying on Getters and Setters
    2m 10s
    In this video, you will learn how to test using spies on object getters and setters. FREE ACCESS
  • Locked
    14.  Using Spies to Test PubSub and jQuery
    5m 51s
    During this video, you will learn how to test real world components using test doubles. FREE ACCESS
  • Locked
    15.  Configuring Behavior with Stubs
    10m 28s
    In this video, you will configure stub behavior in test cases. FREE ACCESS
  • Locked
    16.  Stubbing Object Methods
    7m 36s
    In this video, you will learn how to create stubs for object methods. FREE ACCESS
  • Locked
    17.  Creating Stub Objects without Constructors
    5m 43s
    In this video, find out how to create objects without invoking object constructors. FREE ACCESS
  • Locked
    18.  Mocking Objects and Functions
    8m 55s
    During this video, you will learn how to perform testing using mocks and setting expectations. FREE ACCESS
  • Locked
    19.  Observing Function Invocations with Spy Calls
    9m 32s
    During this video, you will learn how to use spy calls to test function invocations. FREE ACCESS
  • Locked
    20.  Controlling Time Using Fake Timers
    10m 1s
    Learn how to control time in tests to make asynchronous testing easier. FREE ACCESS
  • Locked
    21.  Using Timers with Multiple Async Operations
    6m 13s
    Find out how to use fake timers with multiple async functions. FREE ACCESS
  • Locked
    22.  Testing with Sandboxes
    8m 3s
    In this video, you will learn how to use sandboxes to simplify your testing. FREE ACCESS
  • Locked
    23.  Course Summary
    1m 16s
    In 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.

YOU MIGHT ALSO LIKE

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.4 of 28 users Rating 4.4 of 28 users (28)
Rating 4.2 of 742 users Rating 4.2 of 742 users (742)
Rating 4.6 of 161 users Rating 4.6 of 161 users (161)