You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am trying to use ios_unit_test with multiple static libraries as dependencies. The test code is located in these static libraries. The issue I am facing is that there is a missing reference to the particular tests in the Xcode Test Navigator.
In the attached project, when I run the tests using Bazel, the results look good: all unit tests are executed.
However, when I open Xcode after generating the project, no tests are visible in the Xcode Test Navigator.
If I run all tests using Cmd+U or click on "All Tests" in the Xcode Test Navigator, the tests are detected at runtime:
However, if I try to run only one test, no tests are executed, but this empty execution is reported as successful.
When I keep only one dependency for ios_unit_test and regenerate the project, everything works as expected.
I would be happy to work on this, but I need some help with direction. So far, I believe the issue occurs during the index build. I have tried to find the difference in how apple_rules handles one vs. multiple dependencies for unit tests, but I have not found any differences yet.
This is expected. If the test has multiple deps, then rules_xcodeproj can’t merge the libraries into the top-level target. We can’t merge multiple same-language targets into a top-level target because they have different compiler flags, in particular different module names. And when the top-level target doesn’t have the source files associated with it, then it Xcode index the tests and doesn’t show the gutter diamonds or the tests in the navigator. After one run of the tests though Xcode sees them as dynamic tests and shows them.
Description
Hello, I am trying to use ios_unit_test with multiple static libraries as dependencies. The test code is located in these static libraries. The issue I am facing is that there is a missing reference to the particular tests in the Xcode Test Navigator.
In the attached project, when I run the tests using Bazel, the results look good: all unit tests are executed.
However, when I open Xcode after generating the project, no tests are visible in the Xcode Test Navigator.
If I run all tests using Cmd+U or click on "All Tests" in the Xcode Test Navigator, the tests are detected at runtime:
However, if I try to run only one test, no tests are executed, but this empty execution is reported as successful.
When I keep only one dependency for ios_unit_test and regenerate the project, everything works as expected.
I would be happy to work on this, but I need some help with direction. So far, I believe the issue occurs during the index build. I have tried to find the difference in how apple_rules handles one vs. multiple dependencies for unit tests, but I have not found any differences yet.
simple-unit-test-example.zip
Reproduction steps
In the attached project run
bazel run //:a_and_b_xcodeproj
Expected behavior
To be able to see and run any particular unit test from Xcode test navigator.
rules_xcodeproj version
2.5.2
Xcode version
15.4 (15F31d)
Bazel version
7.2.1
rules_apple version
3.6.0
rules_swift version
2.1.1
Additional information
No response
The text was updated successfully, but these errors were encountered: