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

Add xctrunner rule to create test bundles #2529

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kapoorlakshya
Copy link
Contributor

@kapoorlakshya kapoorlakshya commented Sep 10, 2024

Adds new rule xctrunner which allows bundling of one or more xctests into a single XCTRunner.app. Primary use case is for running UI tests on real device farms, like BrowserStack, Sauce Labs, etc.

Usage

load("//apple:xctrunner.bzl", "xctrunner")

ios_ui_test(
    name = "HelloWorldSwiftUITests",
    minimum_os_version = "15.0",
    runner = "@build_bazel_rules_apple//apple/testing/default_runner:ios_xctestrun_ordered_runner",
    test_host = ":HelloWorldSwift",
    deps = [":UITests"],
)

xctrunner(
    name = "HelloWorldSwiftXCTRunner",
    test_targets = [":HelloWorldSwiftUITests"],
    testonly = True,
)
$ bazel build //examples/ios/HelloWorldSwift:HelloWorldSwiftXCTRunner

INFO: Analyzed target //examples/ios/HelloWorldSwift:HelloWorldSwiftXCTRunner (13 packages loaded, 2236 targets and 13 aspects configured).
INFO: Found 1 target...
Target //examples/ios/HelloWorldSwift:HelloWorldSwiftXCTRunner up-to-date:
  bazel-bin/examples/ios/HelloWorldSwift/HelloWorldSwiftXCTRunner.app
INFO: Elapsed time: 11.108s, Critical Path: 10.32s
INFO: 65 processes: 39 internal, 25 darwin-sandbox, 1 local.
INFO: Build completed successfully, 65 total actions

@kapoorlakshya kapoorlakshya force-pushed the lk/test_runner_bundle branch 3 times, most recently from 5828884 to 86139ab Compare September 13, 2024 23:42
@kapoorlakshya kapoorlakshya changed the title Add xctrunnertool to create test bundles Add xctrunner rule to create test bundles Feb 26, 2025
@kapoorlakshya kapoorlakshya force-pushed the lk/test_runner_bundle branch 10 times, most recently from 680bc38 to 3f044b3 Compare February 27, 2025 23:49
@kapoorlakshya kapoorlakshya force-pushed the lk/test_runner_bundle branch 13 times, most recently from 8cd6f3b to 53d6e3a Compare March 4, 2025 19:59
Comment on lines 93 to 137
# Limiting the contents of AppleBinaryInfo to what is necessary
# for testing and validation.
xctrunner_binary_info = new_applebinaryinfo(
binary = output,
infoplist = None,
product_type = None,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like AppleBundleInfo might be a better fit then, since we are producing a bundle?

@kapoorlakshya kapoorlakshya force-pushed the lk/test_runner_bundle branch from 53d6e3a to 019c196 Compare March 4, 2025 22:06
@kapoorlakshya kapoorlakshya force-pushed the lk/test_runner_bundle branch from 019c196 to b65dfbd Compare March 4, 2025 22:15
@kapoorlakshya kapoorlakshya marked this pull request as ready for review March 5, 2025 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants