iT邦幫忙

鐵人檔案

2023 iThome 鐵人賽
回列表
Mobile Development

在 iOS 專案上加上 Unit testing - 因為 You need testing 系列

在專案中加上 Unit testing

鐵人鍊成 | 共 32 篇文章 | 3 人訂閱 訂閱系列文 RSS系列文
DAY 11

D11 - 在 iOS 專案加上測試-You need testing {台股小工具 app-交易紀錄頁面}

從之前的 wireframe 轉化成預設的 SwiftUI 元件,可以得到下面這樣的基本佈局。 SwiftUI 程式碼 extension StockTrad...

2023-09-22 ‧ 由 Marvin 分享
DAY 12

D12 - 在 iOS 專案加上測試-You need testing {台股小工具 app-股票紀錄轉換par1}

在股票交易紀錄輸入 View 裡面,會需要一個轉換器,在畫面上的 property 按下新增後,進行輸入內容的檢查,以似 Data Model 的轉換。 規格...

2023-09-23 ‧ 由 Marvin 分享
DAY 13

D13 - 在 iOS 專案加上測試-You need testing {台股小工具 app-股票紀錄轉換par2}

測試項目 stockID, stockName, tradingShares, tradingCostPerShare 其中有一個為空時,得到 Error...

2023-09-24 ‧ 由 Marvin 分享
DAY 14

D14 - 在 iOS 專案加上測試-You need testing {台股小工具 app-加上日期}

在之前的實作中,我們並沒有加上成交日期,所以我們來模擬一個情境,追加 feature。 模擬情境:在開發過程中追加原來沒和你講的需求 先假設,我們一開始只收到股...

2023-09-25 ‧ 由 Marvin 分享
DAY 15

D15 - 在 iOS 專案加上測試-You need testing {單一責則原則 - DateUtility}

StockRecordUtility 職責被我定義為轉換 UI 輸入 到程式 Data Model 的物件,而 Date 轉換為 String 則為另一個物件的...

2023-09-26 ‧ 由 Marvin 分享
DAY 16

D16 - 在 iOS 專案加上測試-You need testing {台股小工具 app- test in Combine}

Combine 是一個 Swift 的框架,它提供了一個聲明式的方式來處理非同步的事件和數據流。Combine 可以讓開發者用更簡潔和清晰的代碼來實現複雜的功能...

2023-09-27 ‧ 由 Marvin 分享
DAY 17

D17 - 在 iOS 專案加上測試-You need testing {台股小工具 app-與 UI 進行組裝}

為了能讓 SwiftUI 的 View 可以 observer StockTradingRecordStore 的 property,要讓 StockTradi...

2023-09-28 ‧ 由 Marvin 分享
DAY 18

D18 - 在 iOS 專案加上測試-You need testing {台股小工具 app-StockRecord InputView 和 RecordStore 的組裝}

接下來進行新增股票的 StockRecordInputView 和 RecordStore 的組裝。SettlementRemindInputView 中加入這...

2023-09-29 ‧ 由 Marvin 分享
DAY 19

D19 - 在 iOS 專案加上測試-You need testing {台股小工具 app-測 UserDefaults part1}

在 UIKit 時代,將資料存在裝置上,最常使用的物件就是 UserDefaults,但 UserDefaults 並沒有辦法和 SwiftUI 的 @Stat...

2023-09-30 ‧ 由 Marvin 分享
DAY 20

D20 - 在 iOS 專案加上測試-You need testing {台股小工具 app-測 UserDefaults part2}

step1: 開好測試 class 後,將 TapCounterViewController 設成 sut,把 FakeUserDefaults 設定好變數。在...

2023-10-01 ‧ 由 Marvin 分享