Skip to content

jbehrens94/testing-workshop

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Workshop on Testing SwiftUI

Welcome! This is a "simple" swiftUI app to show station information for a small fictional transit system which references the San Francisco BART system.

There's a simple "backend" which is faked out for previewing the data. See StationService.swift for the protocol and "default" implementation. I'm not going to write and implement a backend for this, as that's outside the scope of this.

For this workshop, you have 2 tasks to implement:

  • Test and implement a detail screen for viewing upcoming trains at a given station. Including error handling.
  • Test and implement caching of the list of stations between launches. This is unlikely to change often, so it doesn't make sense for the user to have to wait for these to fetch. You should still allow users to force-refresh (using Refreshable).

This will be more than enough for our time.

To help get you started, there is already a screen implemented and tested that shows the list of all stations, StationListView.swift. This tested in StationListViewTests.swift, and uses Swift-Testing, ViewInspector, and the Swift-Fakes libraries.

You'll note that I'm also using an experimental version of the Swift Testing library, specifically to use a still-in-pitch polling confirmations feature. These allow you to check for when a component's state changes over some period. Which is especially useful when testing UI code as you often want to check behavior that happens in a background thread as a result of interactions on the main thread. Take a look at the pitch thread on the swift forums for more details.

There are also no UI tests here. That's not really the point of this workshop.

There is a reference solution, available at the reference-solution branch.

About

Testing Workshop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%