IOS Unit Testing by Example: Xctest Tips and Techniques Using Swift (Paperback)

Reid, Jon

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

相關主題

商品描述

Fearlessly change the design of your iOS code with solid unit tests. Use Xcode's built-in test framework XCTest and Swift to get rapid feedback on all your code - including legacy code. Learn the tricks and techniques of testing all iOS code, especially view controllers (UIViewControllers), which are critical to iOS apps. Learn to isolate and replace dependencies in legacy code written without tests. Practice safe refactoring that makes these tests possible, and watch all your changes get verified quickly and automatically. Make even the boldest code changes with complete confidence.

Manual code and UI testing get slower the deeper your navigation hierarchy goes. It can take several taps just to reach a particular screen, never mind the actual workflow tests. Automatic unit testing offers such rapid feedback that it can change the rules of development. Bring testing to iOS development, even for legacy code. Use XCTest to write unit tests in Swift for all your code.

iOS developers typically reserve unit tests for their model classes alone. But that approach skips most of the code common to iOS apps, especially with UIViewControllers. Learn how to unit test these view controllers to expand your unit testing possibilities. Since good unit tests form the bedrock for safe refactoring, you're empowered to make bold changes. Learn how to avoid the most common mistakes Swift programmers make with the XCTest framework. Use code coverage to find holes in your test suites. Learn how to identify hard dependencies.

Reshape the design of your code quickly, with less risk and less fear.

商品描述(中文翻譯)

無需翻譯 C、Java、JavaScript、Python、Ruby、Go 等程式語言名稱
無需翻譯 React, Scrum, Kubernetes, Docker, ElasticSearch、Power BI、RESTful 等技術名稱
無需翻譯 英文人名、地名、學校名稱、公司名稱等

「毫不畏懼地改變你的 iOS 代碼設計,並使用堅實的單元測試。使用 Xcode 內建的測試框架 XCTest 和 Swift,對所有代碼(包括舊代碼)獲得快速反饋。學習測試所有 iOS 代碼的技巧和技巧,尤其是對於 iOS 應用程序至關重要的視圖控制器(UIViewControllers)。學習如何在沒有測試的舊代碼中隔離和替換依賴項。實踐安全的重構,使這些測試成為可能,並觀察所有更改得到快速且自動的驗證。即使是最大膽的代碼更改,也能充滿信心地進行。」

「隨著導航層次的加深,手動代碼和 UI 測試變得越來越慢。只是為了到達特定屏幕,可能需要點擊多次,更不用說實際的工作流程測試了。自動單元測試提供如此快速的反饋,可以改變開發的規則。即使是舊代碼,也要將測試引入 iOS 開發中。使用 XCTest 在 Swift 中為所有代碼編寫單元測試。」

「iOS 開發人員通常只將單元測試保留給模型類。但這種方法忽略了大部分 iOS 應用程序常見的代碼,尤其是 UIViewControllers。學習如何對這些視圖控制器進行單元測試,擴展你的單元測試可能性。由於良好的單元測試是安全重構的基石,你有能力進行大膽的更改。學習如何避免 Swift 程序員在 XCTest 框架中常見的錯誤。使用代碼覆蓋率找出測試套件中的漏洞。學習如何識別硬依賴關係。」

「以更少的風險和更少的恐懼快速重塑你的代碼設計。」

作者簡介

Jon Reid is a leading expert in unit testing and Test-Driven Development for iOS development. He has been practicing TDD on Apple platforms since 2001. His blog, https: //qualitycoding.org focuses on iOS unit testing practices.

作者簡介(中文翻譯)

Jon Reid是iOS開發中單元測試和測試驅動開發的領先專家。自2001年以來,他一直在蘋果平台上實踐TDD。他的博客https://qualitycoding.org專注於iOS單元測試實踐。