Book Image

Mastering ArcGIS Server Development with JavaScript

By : Raymond Kenneth Doman
Book Image

Mastering ArcGIS Server Development with JavaScript

By: Raymond Kenneth Doman

Overview of this book

Table of Contents (18 chapters)
Mastering ArcGIS Server Development with JavaScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 based on requirements.

  2. Run all tests and see that the new test fails. This eliminates unnecessary tests and tests the overall testing framework.

  3. Write some code to pass the test.

  4. Run the tests again.

  5. Refactor as necessary to clean up ugly code, names,...