Jasmine JavaScript Testing

Paulo Ragonha

  • 出版商: Packt Publishing
  • 出版日期: 2013-08-24
  • 售價: $1,390
  • 貴賓價: 9.5$1,321
  • 語言: 英文
  • 頁數: 146
  • 裝訂: Paperback
  • ISBN: 178216720X
  • ISBN-13: 9781782167204
  • 相關分類: JavaScript
  • 下單後立即進貨 (約3~4週)

相關主題

商品描述

If you want to take your JavaScript coding to a new level of reliability and proficiency, this book is for you. Discover how to use Jasmine for unit testing whilst learning best practice for the whole JavaScript universe.

Overview

  • Learn the power of test-driven development while creating a fully-featured web application
  • Understand the best practices for modularization and code organization while putting your application to scale
  • Leverage the power of frameworks such as BackboneJS and jQuery while maintaining the code quality
  • Automate everything from spec execution to build; leave repetition to the monkeys

In Detail

From a little renegade scripting language to the de facto standard platform of today, JavaScript has become a universal language available in the widest range of devices; it is truly the 'write once, run everywhere’ language. However, as JavaScript applications become more complicated, testing and applying sustainable software engineering practices also become mandatory.

Jasmine JavaScript Testing is a practical guide to a more sustainable JavaScript development process. You will learn by example how to drive the development of a web application using tests and best practices.

This book is about becoming a better JavaScript developer. So, throughout the chapters, you will not only learn about writing tests, but also about the best practices for writing software in the JavaScript language. This book is about acknowledging JavaScript as a real platform for application development and leveraging all of its potential. You will also learn about tooling and automation and how to make your life easier and more productive.

You will learn how to create a sustainable codebase with the help of Jasmine. We will take a look at integrated testing (with a backend NodeJS server) and how you can speed this process up by faking AJAX requests. As you progress through the book, you will learn about the challenges of testing an application built on top of a framework and how you can prevent your application from suffering from dependency management hell. Also, since your applications need to get into production, you will learn about optimizing the code to reduce the number of requests the browser needs to make while loading your application.

With this book, you will learn everything you need to know to become a real professional in the ever-demanding JavaScript universe.

What you will learn from this book

  • Drive your application development entirely by tests
  • Organize your application code in modules with RequireJS
  • Create a fully-tested jQuery plugin
  • Solve problems and learn best practices for asynchronous testing
  • Use Stubs and Spies to perform quick unit testing
  • Test-drive a BackboneJS application
  • Optimize your JavaScript code to production
  • Master the power of tooling and automation with GruntJS
  • Run your tests on the cloud with Travis-CI

Approach

The book uses a concise, to-the-point approach to help developers understand and use the power of Jasmine to create better and more maintainable codebases.

Who this book is written for

This book is a must-have guide for web developers who are new to the concept of unit testing. It’s assumed that you have a basic knowledge of JavaScript and HTML.

商品描述(中文翻譯)

如果你想將你的 JavaScript 編碼提升到一個更可靠和熟練的水平,這本書就是為你而寫的。在學習整個 JavaScript 宇宙的最佳實踐的同時,探索如何使用 Jasmine 進行單元測試。

概述:
- 在創建一個功能完整的 Web 應用程序的同時,學習測試驅動開發的力量
- 理解模塊化和代碼組織的最佳實踐,同時將你的應用程序擴展到更大規模
- 利用 BackboneJS 和 jQuery 等框架的威力,同時保持代碼質量
- 自動化從規格執行到構建的一切;將重複工作交給機器

詳細內容:
從一個小小的叛逆腳本語言到如今的事實標準平台,JavaScript 已成為一種在各種設備上都可用的通用語言;它真正是“一次編寫,到處運行”的語言。然而,隨著 JavaScript 應用程序變得越來越複雜,測試和應用可持續軟件工程實踐也變得必不可少。

《Jasmine JavaScript Testing》是一本實用指南,旨在實現更可持續的 JavaScript 開發流程。通過實例學習如何使用測試和最佳實踐來推動 Web 應用程序的開發。

這本書是關於成為一個更好的 JavaScript 開發者。因此,在各章中,你不僅會學習如何撰寫測試,還會學習 JavaScript 語言編寫軟件的最佳實踐。這本書是關於承認 JavaScript 是一個真正的應用程序開發平台,並充分利用其潛力。你還將學習有關工具和自動化的知識,以使你的生活更輕鬆和高效。

你將學習如何通過 Jasmine 創建一個可持續的代碼庫。我們將研究集成測試(使用後端 NodeJS 服務器)以及如何通過模擬 AJAX 請求來加快此過程。隨著你在本書中的進展,你將了解在框架之上構建應用程序的測試面臨的挑戰,以及如何防止你的應用程序遭受依賴管理地獄的困擾。此外,由於你的應用程序需要投入生產,你還將學習如何優化代碼以減少瀏覽器在加載應用程序時需要發出的請求數量。

通過這本書,你將學到成為 JavaScript 領域中真正的專業人士所需的一切。

你將從這本書中學到:
- 通過測試完全驅動你的應用程序開發
- 使用 RequireJS 將你的應用程序代碼組織成模塊
- 創建一個經過完整測試的 jQuery 插件
- 解決問題並學習異步測試的最佳實踐
- 使用 Stub 和 Spy 進行快速單元測試
- 測試驅動 BackboneJS 應用程序
- 將你的 JavaScript 代碼優化到生產環境
- 掌握 GruntJS 的工具和自動化的威力
- 在 Travis-CI 上運行你的測試

方法:
本書使用簡潔、直接的方法,幫助開發人員理解和使用 Jasmine 的威力,創建更好、更易維護的代碼庫。

本書適合對單元測試概念尚不熟悉的 Web 開發人員。假設你具備基本的 JavaScript 和 HTML 知識。