Testing as you code

Many developers have found that the best time to test their code is when they are writing it. It's a horrible feeling when you spend all day writing a module, only to have it fail and not know why. By creating unit tests in the middle of development, the developer receives quick feedback regarding whether part of their code succeeds or fails. Now, let's look at some ways developers write tests as they code.

Test-Driven Development

Test-Driven Development (TDD) is the process of writing unit tests and end-to-end tests, then writing code to pass those tests. Whenever code is refactored, it runs through the same tests to ensure results come out as expected.

Developers using TDD tend to code using the following steps:

  1. Write a test ...

Get Mastering ArcGIS Server Development with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.