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

Bug: XCTest traces are missing in failure context #3044

Open
luispadron opened this issue Jun 18, 2024 · 3 comments
Open

Bug: XCTest traces are missing in failure context #3044

luispadron opened this issue Jun 18, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@luispadron
Copy link
Contributor

Description

In Xcode 12+ a test case which calls into a function that then calls something like XCTFail/XCTAssert* has proper traces back up the stack to the originating caller. This helps diagnose where the test case failure is called. This happens automatically in a new Xcode 12+ project, for example:

Screenshot 2024-06-18 at 11 07 52 AM

The same code in a BwB rules_xcodeproj project only shows the trace for the XCTAssert:

Screenshot 2024-06-18 at 11 14 28 AM

Reproduction steps

Write a test which calls into some other function that then fails. Or see the attached zip with a vanilla Xcode and rules_xcodeproj example to reproduce the issue.

TestTracingExample.zip

Expected behavior

The test failures look like they do in vanilla Xcode

rules_xcodeproj version

2.4.0

Xcode version

15.4

Bazel version

7.2.0

rules_apple version

3.5.1

rules_swift version

1.18.0

Additional information

No response

@luispadron luispadron added the bug Something isn't working label Jun 18, 2024
@shuguenot
Copy link

This bug is extremely annoying, as it drastically complicates daily work with XCTest. Could it be prioritized ?

@brentleyjones
Copy link
Contributor

I expect this is yet another "relative paths break Xcode" issue (e.g. #1119, #1284, #1336). Try launching Xcode from the Bazel execution root (I believe described in one or more of those issues) to see if that fixes it.

This might be fixable the same way that we fixed test issues to begin with, by swizzling something: bazelbuild/apple_support#128.

@dask8
Copy link

dask8 commented Nov 19, 2024

Same issue with Swift Testing, we only see test failures inline at the top-level test function level, not at the actual point of failure in the test sources. Would really love to see this issue fixed as-well 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants