Test-Driven JavaScript Development

Ravi Kumar Gupta, Hetal Prajapati, Harmeet Singh

  • 出版商: Packt Publishing
  • 出版日期: 2015-12-21
  • 售價: $1,810
  • 貴賓價: 9.5$1,720
  • 語言: 英文
  • 頁數: 240
  • 裝訂: Paperback
  • ISBN: 1782174923
  • ISBN-13: 9781782174929
  • 相關分類: JavaScriptTDD 測試導向開發
  • 海外代購書籍(需單獨結帳)

相關主題

商品描述

Learn JavaScript test-driven development using popular frameworks and tools

About This Book

  • Learn the life cycle of TDD and its importance in real-world application
  • Gain knowledge about popular tools and analyze features, syntax, and how they help in JavaScript testing
  • Implement test-driven programming exercises using the practical code examples

Who This Book Is For

If you have an intermediate knowledge of HTML, CSS, and JavaScript and want to learn how and why the test-driven development approach is better for your assignments, then this book is for you.

What You Will Learn

  • Basic TDD fundamentals, life cycle, and benefits
  • Become acquainted with the concepts and elements of unit testing and writing basic unit tests for JavaScript
  • Understand the way JsUnit, Qunit, Karma and DalekJs work
  • Use the Jasmine framework
  • Interpret feature detection and devise tests specific to cross-browser compatibility
  • Integrate jsTestDriver with Eclipse and run tests with jsTestDriver
  • Explore re-factoring, adding and notifying observers
  • Understand test-driven development in case of server-side JS

In Detail

Initially, all processing used to happen on the server-side and simple output was the response to web browsers. Nowadays, there are so many JavaScript frameworks and libraries created that help readers to create charts, animations, simulations, and so on. By the time a project finishes or reaches a stable state, so much JavaScript code has already been written that changing and maintaining it further is tedious. Here comes the importance of automated testing and more specifically, developing all that code in a test-driven environment. Test-driven development is a methodology that makes testing the central part of the design process – before writing code developers decide upon the conditions that code must meet to pass a test. The end goal is to help the readers understand the importance and process of using TDD as a part of development.

This book starts with the details about test-driven development, its importance, need, and benefits. Later the book introduces popular tools and frameworks like YUI, Karma, QUnit, DalekJS, JsUnit and goes on to utilize Jasmine, Mocha, Karma for advanced concepts like feature detection, server-side testing, and patterns. We are going to understand, write, and run tests, and further debug our programs. The book concludes with best practices in JavaScript testing. By the end of the book, the readers will know why they should test, how to do it most efficiently, and will have a number of versatile tests (and methods for devising new tests) to get to work immediately.

Style and approach

Easy-to-follow guide with suitable examples for developing JavaScript code in the test-Driven environment, with popular tools and frameworks. User experience and statements are also included to help readers make a better choice of tool for real-world projects.

商品描述(中文翻譯)

學習使用流行的框架和工具進行JavaScript測試驅動開發

關於本書

- 學習TDD的生命週期及其在實際應用中的重要性
- 瞭解流行工具的特點、語法和它們在JavaScript測試中的幫助
- 使用實際代碼示例實施測試驅動的編程練習

適合閱讀對象

如果您對HTML、CSS和JavaScript有中級知識,並且想要瞭解為什麼測試驅動開發方法對您的任務更好,那麼本書適合您。

您將學到什麼

- 基本的TDD基礎知識、生命週期和好處
- 熟悉單元測試的概念和元素,並編寫JavaScript的基本單元測試
- 瞭解JsUnit、Qunit、Karma和DalekJs的工作方式
- 使用Jasmine框架
- 解釋功能檢測並制定特定於跨瀏覽器兼容性的測試
- 將jsTestDriver與Eclipse集成並使用jsTestDriver運行測試
- 探索重構、添加和通知觀察者
- 瞭解服務器端JS的測試驅動開發

詳細內容

最初,所有處理都在服務器端進行,簡單的輸出是對Web瀏覽器的響應。如今,有許多JavaScript框架和庫可以幫助讀者創建圖表、動畫、模擬等等。當一個項目完成或達到穩定狀態時,已經編寫了大量的JavaScript代碼,進一步更改和維護變得繁瑣。這就是自動化測試的重要性,更具體地說,是在測試驅動的環境中開發所有代碼的重要性。測試驅動開發是一種方法論,將測試作為設計過程的核心部分-在編寫代碼之前,開發人員確定代碼必須滿足的條件以通過測試。最終目標是幫助讀者瞭解在開發過程中使用TDD的重要性和過程。

本書從詳細介紹測試驅動開發的細節、重要性、需求和好處開始。然後,本書介紹了流行的工具和框架,如YUI、Karma、QUnit、DalekJS、JsUnit,並使用Jasmine、Mocha、Karma等進行高級概念的實現,如功能檢測、服務器端測試和模式。我們將瞭解、編寫和運行測試,並進一步調試我們的程序。本書以JavaScript測試的最佳實踐結束。通過閱讀本書,讀者將瞭解為什麼應該進行測試,如何以最高效的方式進行測試,並擁有許多多功能的測試(以及設計新測試的方法),可以立即開始工作。

風格和方法

易於遵循的指南,提供適合在測試驅動環境中開發JavaScript代碼的示例,並提供了幫助讀者在實際項目中做出更好選擇的用戶體驗和語句。