Simplifies running UI-tests
- TestRunner is a Swift package that simplifies running UI tests for iOS and macOS.
- It allows you to create scenes that can be played and receive notifications upon their completion.
- You can iterate through scenes in sequences, reuse common scenes such as
LoginScene
andLogoutScene
, and operate asynchronously.
TestRunner allows you to:
- Create scenes that you can play and receive notifications upon their completion (asynchronously).
- Iterate through scenes in sequences.
- Reuse common scenes such as
LoginScene
andLogoutScene
. - Operate asynchronously.
- Step: A single interaction logic, usually encapsulated in an anonymous closure.
- Scene: A series of steps.
- Sequence: A series of scenes.
Here is a QA Test prototype for debugging a playlist feature:
You can install TestRunner using Swift Package Manager. Simply add the following line to your Package.swift
file:
.package(url: "https://github.com/eonist/TestRunner.git", from: "1.0.0")
Then add TestRunner
as a dependency for your target:
.target(
name: "MyTarget",
dependencies: [
"TestRunner",
]
),
Alternatively, you can add TestRunner to your project using Xcode. Simply go to File > Swift Packages > Add Package Dependency
and enter the URL of this repository.
class SearchScene {
override run(){
let searchBar = XTElement.findFirst("SearchBar")
searchBar.search("Eminem")
let searchButton = XTElement.findFirst("SearchButton")
searchButton.tap()
onComplete()
}
}
let sequence: [SceneKind.Type] = [LoginScene.self, SearchScene.self, LogoutScene.self]
let runner: SceneRunner = .init(sequence: sequence, onComplete: {})
runner.complete { Swift.print("All scenes completed π") }
runner.app.launch()
runner.iterate() // π
Warning
Add this framework via XCode SPM-package-manager to theUITesting-target
in xcode, not main target
-
Using XCTest and XCTestCase for iOS Tests: A comprehensive guide on utilizing XCTest and XCTestCase for iOS testing.
-
Using XCTest Extension in a Swift Package: An informative post detailing the integration of XCTest extension within a Swift package.
-
Xcode UI Testing Cheat Sheet: A handy cheat sheet offering quick reference for Xcode UI testing.
- Add example project (See TabNav-project, playlist-project, UITesting-project, or make a new one) πππ
- Maybe add ideas from AccessRunner project, might have advanced ways of doing things etc π
- Maybe use semaphore to make async -> sync ? π
- Create a test project in SwiftUI
- Error Handling and Logging in Scene Execution The Scene class's run method currently uses a placeholder implementation that simply throws a fatal error if not overridden. This could be improved by adding error handling capabilities, which would allow for better debugging and error logging.
- SwiftUI Migration: The AppDelegate in the TestRunnerApp uses UIKit and has a comment suggesting migration to SwiftUI. This could improve maintainability and modernize the codebase.
- Testing Enhancements: The SceneRunner class could include more robust testing features, such as support for launch options to customize the app's launch configuration. This would allow for more flexible and comprehensive testing scenarios.
- SwiftLint Integration: The GitHub Actions workflow mentions an issue with SwiftLint integration. Addressing this could help maintain code quality and consistency across the project.
- UI Testing Enhancements: The UI tests could be expanded to cover more scenarios and utilize the capabilities of UITestSugar more effectively. This would ensure that the UI components work as expected under various conditions.