Over a million developers have joined DZone.

Testing Tuesday Episode 18: How to Test Asynchronous JavaScript with Jasmine

DZone's Guide to

Testing Tuesday Episode 18: How to Test Asynchronous JavaScript with Jasmine

· Performance Zone
Free Resource

Discover 50 of the latest mobile performance statistics with the Ultimate Guide to Digital Experience Monitoring, brought to you in partnership with Catchpoint.

This is the 18th Testing Tuesday episode. Every week we share our insights and opinions on the software testing space. Drop by every Tuesday to learn more! Last week we spied on JavaScript methods with Jasmine.

Testing Asynchronous JavaScript Operations

In the last two Testing Tuesday episodes we got familiar with Jasmine. If you haven’t already, watching Testing Tuesday #16 will make it easier to follow along with this episode.

JavaScript is the perfect language for asynchronous operations. Although they make our apps fast, elegant and responsive, they are also a challenge to test.

Jasmine provides two strategies for testing asynchronous operations:

  1. Waiting for certain events to occur until a timeout
  2. Mocking the JavaScript clock and simulating that time passes

In this screencast we cover both strategies and show you which one is appropriate for which situation.

Up Next Testing Tuesday: Testing Node.js Applications

So far we’ve used Jasmine only in the web browser. Next week we’ll show you how to test your Node.js applications with Jasmine. If you’ve got any questions or suggestions, please leave us a comment!


Is your APM strategy broken? This ebook explores the latest in Gartner research to help you learn how to close the end-user experience gap in APM, brought to you in partnership with Catchpoint.


Published at DZone with permission of Clemens Helm, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}