Background Image
Table of Contents Table of Contents
Previous Page  303 / 478 Next Page
Information
Show Menu
Previous Page 303 / 478 Next Page
Page Background

selenium.common.exceptions.TimeoutException: Message: ''

---------------------------------------------------------------------

Ran 1 test in 28.779s

FAILED (errors=1)

Destroying test database for alias 'default'...

Hooray! I mean, I know it failed, but we saw it popping up the Persona dialog and getting

through it and everything! Next chapter: the server side.

On Spiking and Mocking with JavaScript

Spiking

Exploratory coding to find out about a new API, or to explore the feasibility of a

new solution. Spiking can be done without tests. It’s a good idea to do your spike

on a new branch, and go back to master when de-spiking.

Mocking

We use mocking in unit tests when we have an external dependency that we don’t

want to actually use in our tests. A mock is used to simulate the third-party API.

Whilst it is possible to “roll your own” mocks in JavaScript, a mocking framework

like Sinon provides a lot of helpful shortcuts which will make it easier to write (and

more importantly, read) your tests.

Unit testing Ajax

Sinon is a great help here. Manually mocking Ajax methods is a real pain.

JavaScript Unit Tests Involving External Components: Our First Mocks!

|

275