Angular TestDriven Development Second Edition
暫譯: Angular 測試驅動開發(第二版)

Md. Ziaul Haq

  • 出版商: Packt Publishing
  • 出版日期: 2017-02-08
  • 定價: $1,330
  • 售價: 6.0$798
  • 語言: 英文
  • 頁數: 252
  • 裝訂: Paperback
  • ISBN: 1786465477
  • ISBN-13: 9781786465474
  • 相關分類: Angular
  • 立即出貨 (庫存=1)

買這商品的人也買了...

商品描述

About This Book

  • Learn test-driven development (TDD) for JavaScript
  • Improve your Karma and Protractor expertise by setting up an Angular test suite
  • A wide range of testing techniques for professional Angular applications accompanied by practical examples

Who This Book Is For

This book is for developers who have experience with Angular but want to understand the wider context of when, why, and how to apply testing techniques and best practices to create quality clean code. To get the most out of this book, you should have a good understanding of HTML and JavaScript and a basic understanding of Angular.

What You Will Learn

  • Get a clear overview of TDD in the context of JavaScript with a brief look at testing techniques, tools, and frameworks
  • Get an overview of Karma and create test suites for an Angular application
  • Install and configure Protractor for Angular and explore a few important Protractor APIs
  • Understand automated testing and implement headless automated tests with Karma
  • Implement testing techniques with mocks, broadcast events, and asynchronous behavior
  • Integrate REST-based services and APIs into an application to extract data
  • Automate Karma unit tests with Travis CI

In Detail

This is a complete guide that shows you testing techniques with Karma that will help you perform unit testing and end-to-end testing with Protractor. It will show you how to optimize your Angular development process using TDD techniques and ensure your final project is free of bugs. All examples in this book are based on Angular v2 and are compatible with Angular v4.

We start by reviewing the TDD life cycle, TDD in the context of JavaScript, and various JavaScript test tools and frameworks. You will see how Karma and Protractor can make your life easier while running JavaScript unit tests. We will enable you to build a test suite for an Angular application and build a testable medium-to-large scale Angular application by handling REST API data.

Building on the initial foundational aspects, we move on to testing for multiple classes, partial views, location references, CSS, and the HTML element. In addition, we will explore how to use a headless browser with Karma. We will also configure a Karma file to automate the testing and tackle elements of Angular (components, services, classes, and broadcasting) using TDD.

Finally, you will find out how to pull data using an external API, set up and configure Protractor to use a standalone Selenium server, and set up Travis CI and Karma to test your application.

Style and approach

This book is a complete guide to Angular unit testing techniques using Karma and performing end-to-end testing with Protractor.

商品描述(中文翻譯)

## 本書介紹

- 學習 JavaScript 的測試驅動開發 (TDD)
- 透過設置 Angular 測試套件來提升您對 Karma 和 Protractor 的專業知識
- 提供專業 Angular 應用程式的廣泛測試技術,並附有實用範例

## 本書適合誰閱讀

本書適合有 Angular 經驗的開發者,想要了解在何時、為何以及如何應用測試技術和最佳實踐來創建高品質的乾淨代碼。為了充分利用本書,您應該對 HTML 和 JavaScript 有良好的理解,並對 Angular 有基本的認識。

## 您將學到什麼

- 獲得 JavaScript 上下文中 TDD 的清晰概述,簡要了解測試技術、工具和框架
- 獲得 Karma 的概述並為 Angular 應用程式創建測試套件
- 安裝和配置 Protractor 以用於 Angular,並探索幾個重要的 Protractor API
- 理解自動化測試並使用 Karma 實現無頭自動化測試
- 使用模擬、廣播事件和非同步行為實施測試技術
- 將基於 REST 的服務和 API 整合到應用程式中以提取數據
- 使用 Travis CI 自動化 Karma 單元測試

## 詳細內容

這是一本完整的指南,展示了使用 Karma 的測試技術,幫助您進行單元測試和使用 Protractor 進行端到端測試。它將展示如何使用 TDD 技術優化您的 Angular 開發過程,並確保您的最終專案沒有錯誤。本書中的所有範例均基於 Angular v2,並與 Angular v4 兼容。

我們將從回顧 TDD 生命週期、JavaScript 上的 TDD 以及各種 JavaScript 測試工具和框架開始。您將看到 Karma 和 Protractor 如何在運行 JavaScript 單元測試時使您的生活更輕鬆。我們將使您能夠為 Angular 應用程式構建測試套件,並通過處理 REST API 數據來構建可測試的中大型 Angular 應用程式。

在初步基礎方面的基礎上,我們將進一步測試多個類別、部分視圖、位置參考、CSS 和 HTML 元素。此外,我們將探索如何使用無頭瀏覽器與 Karma。還將配置 Karma 文件以自動化測試,並使用 TDD 處理 Angular 的各個元素(組件、服務、類別和廣播)。

最後,您將了解如何使用外部 API 提取數據,設置和配置 Protractor 以使用獨立的 Selenium 伺服器,並設置 Travis CI 和 Karma 來測試您的應用程式。

## 風格與方法

本書是一本完整的指南,介紹使用 Karma 的 Angular 單元測試技術以及使用 Protractor 進行端到端測試。