Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for hosting UI automation tests #516

Open
HollyFoxtel opened this issue Jul 1, 2024 · 2 comments
Open

Support for hosting UI automation tests #516

HollyFoxtel opened this issue Jul 1, 2024 · 2 comments
Labels
darwin 🍎 macOS, iOS, watchOS, tvOS, and visionOS support enhancement New feature or request public-api Affects public API question Further information is requested

Comments

@HollyFoxtel
Copy link

HollyFoxtel commented Jul 1, 2024

Description

Looks that Swift Testing does not support UITest at the moment. Any plans to support UITest in the future?

Certainly, there are some differences in testing APIs between unit testing and UI testing, But supporting UITest would help maintain a unified and friendly testing experience and test ecosystem.

Expected behavior

Use Swift testing in UITest

Actual behavior

Can not import Testing in UITest Target

image

Steps to reproduce

No response

swift-testing version/commit hash

No response

Swift & OS version (output of swift --version && uname -a)

No response

@HollyFoxtel HollyFoxtel added the enhancement New feature or request label Jul 1, 2024
@HollyFoxtel HollyFoxtel changed the title UITest Support Any UITest Support Plan? Jul 1, 2024
@HollyFoxtel HollyFoxtel changed the title Any UITest Support Plan? Any plan to support UITesting in the future? Jul 1, 2024
@stmontgomery
Copy link
Contributor

Thanks for bringing this up, @HollyFoxtel!

Swift Testing itself is primarily concerned with defining tests, running them, and getting their results. The exactly nature of those tests, i.e. the steps they perform, Swift Testing is agnostic about.

On Apple platforms, XCTest provides UI automation APIs like XCUIApplication for automating apps in its (closed-source) framework included in Xcode. Currently, those APIs do not behave correctly when used in Swift Testing tests, so in Xcode 16 Beta, the build system shows the error you mentioned when attempting to import Testing in any UI test target. To allow using XCTest's UI automation features within Swift Testing tests, work will be needed in Apple's proprietary XCTest framework. Since that project is separate, I encourage you to file a Feedback with Apple requesting this functionality.

Beyond that, it is also likely that additional supporting functionality will need to be added here, in Swift Testing, to allow UI testing systems to work properly. For example, there may need to be additional controls over parallelization or result reporting. These kinds of enhancements need to be explored and defined, but they would potentially be relevant/applicable to any UI automation system, not just XCTest UI automation. In general, we do want Swift Testing to be capable of hosting UI automation style tests, although this is not something which we have the capacity to focus on for its initial release aligned with Swift 6. We will keep this GitHub issue open to track the aspects of this work which directly affect Swift Testing.

@stmontgomery stmontgomery changed the title Any plan to support UITesting in the future? Support for hosting UI automation tests Jul 1, 2024
@grynspan grynspan added question Further information is requested darwin 🍎 macOS, iOS, watchOS, tvOS, and visionOS support public-api Affects public API labels Jul 2, 2024
@grynspan
Copy link
Contributor

Tracked internally at Apple with rdar://95593221.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
darwin 🍎 macOS, iOS, watchOS, tvOS, and visionOS support enhancement New feature or request public-api Affects public API question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants