Errata for iOS Test-Driven Development by tutorials 2nd Edition

Creating this topic to catch any typos and bugs in the 2nd Edition of iOS Test-Driven Development by Tutorials.

In chapter 3, there are a couple issues (as I see them). First issue: In the section labeled ā€œWriting the testā€, you updated the function startStopPause with let titleā€¦ and startButtonā€¦, but didnā€™t update viewDidLoad. You later had us remove those lines after adding the function updateButton. The tests didnā€™t pass until we did that change. Second issue: The paragraph that begins with ā€œPart of writing comprehensive unit testsā€ is duplicated and the second instance doesnā€™t make sense. The 2 lines referenced donā€™t belong where the paragraph indicates.

In chapter 5, the image just before subheading ā€œGetting specific about notificationsā€ is missing and it shows an error: ā€œThis image is missing a width attributeā€¦ā€.

In Chapter 3 - Test nomenclature - Appears to be a typo
XCTAssertEqual(observedSate, AppState.inProgress)
Expected
XCTAssertEqual(observedState, AppState.inProgress)

@theidude thanks for reporting, sorry for the confusion

image

@mkatz @jellodiil
In chapter 3
This paragraph is duplicated.
Here the paragraph should mention that the following code should be added to the viewDidLoad() function.

Regards

2 Likes

The duplicated paragraph has still not been corrected. It references testing code instead of referencing the production code within the viewDidLoad().

I initially I wrote the code in the init(). So my code did not require the following in the test code: sut.viewDidLoad(). I had to look at the final code sample to see what the authors intended.

Thanks.

In chapter 6, in the Challenge repo, code was merged but not resolved for SceneDelegate: itdd-materials/SceneDelegate.swift at editions/2.0 Ā· kodecocodes/itdd-materials Ā· GitHub

The file should not have been updated. SwiftUI was never introduced into the project. Revert the code back to match editions/1.0 and the code will compile correctly. Please, update the github repo.

Chapter: 2
Title: The TDD Cycle
Action: Word Replacement ("separate")

ā€œThereā€™s then an underscore to seprate it from theā€¦ā€

Chapter: 8
Title: RESTful Networking
Section: Creating the session protocols
Action: Word Replacement ("DogPatchTests")

ā€œWithin DogPatch/Networking, create a new Swift File called URLSessionProtocol.swift and replaceā€¦ā€

Chapter : 8
Title : RESTful Networking
Section : Conforming to the session protocols
Action: Code Replacement
XCTAssertEqual(task.originalRequest!.url!, url)

"

func test_URLSession_makeDataTask_createsTaskWithPassedInURL() {
  // given
  let url = URL(string: "https://example.com")!

  // when
  let task = session.makeDataTask(
    with: url,
    completionHandler: { _, _, _ in })
  as! URLSessionTask

  // then
  XCTAssertEqual(task.originalRequest?.url, url)
}

"

Chapter : 8
Title : RESTful Networking
Section : Conforming to the session protocols
Action: Word Replacement ("waitForExpectations" )

This test verifies theā€¦ You verify the expectation is fulfilled via waitForExpecations .

Chapter: 10 ImageClient
Section: Handling a download image error
Problem: Minor typo in test name
Where: book & github repo
itdd-materials/ImageClientTests.swift at editions/2.0 Ā· kodecocodes/itdd-materials Ā· GitHub
Test Name: test_setImageOnImageView_givenError_doesnSetImage()
Correction: test_setImageOnImageView_givenError_doesntSetImage()
missing ā€œtā€ as in doesnt Set Image

Chapter: 10 ImageClient
Section: Using the image client
Problem: Code deprecated
within ListingsViewController

var imageClient: ImageService = ImageClient(responseQueue: nil, session: URLSession())

Warning:
ā€˜init()ā€™ was deprecated in iOS 13.0: Please use +[NSURLSession sessionWithConfiguration:] or other class methods to create instances
Where: book only
Correction:

var imageClient: ImageService = ImageClient(responseQueue: nil, session: URLSession(configuration: .default))

Chapter: 11 Legacy Problems (2nd Ed)
Section: Setting up the app and backend
Problem: Vapor Backend project does not open in Xcode
After running vapor command in terminal, text displays: Opening project in Xcode.
Nothing happens after that. Xcode does not open. Syncing and downloading do not happen.
Where: book only
Incorrect statement:

  1. Open a Terminal and navigate to the projects/backend folder.

Correction:

  1. Open a Terminal and navigate to the projects/backend/MyBiz folder.

Vapor comand needs to run from the same folder containing the Package.swift file.

Chapter: 14 Modularizing Dependencies (2nd Ed)
Section: Moving files
Problem: Dependency Map still shows circular dependencies
LoginViewController should not show dependency on AppDelegate nor UIViewController+Alert.
API should not show dependency on AppDelegate.
Where: ebook only
Correction: Replace image with last dependency map in chapter 13.
No circular dependencies. LoginViewController box is green.

I still see the error, is this going to be fix in the future?