Quick / Nimble

A Matcher Framework for Swift and Objective-C

Home Page:https://quick.github.io/Nimble/documentation/nimble/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Attempted to report a test failure to XCTest while no test case was running

Bogdan-Belogurov opened this issue · comments

What did you do?

Upgraded the Nimble to 13.0.0 from 9.2.0 and Quick to 7.3.0 from 4.0.0 to use AsyncSpec

What did you expect to happen?

AsyncSpec should notify about errors like regular QuickSpec.

What actually happened instead?

When I moved some tests to AsyncSpec.
and received: Attempted to report a test failure to XCTest while no test case was running. error.
Maybe you know how I can avoid this bug?

image

Environment

List the software versions you're using:

  • Quick: 13.0.0
  • Nimble: 7.3.0
  • Xcode Version: 14.3 (14E222b)
  • Swift Version: 5.8

Please also mention which package manager you used and its version. Delete the
other package managers in this list:

  • Tuist 3.28.0

Project that demonstrates the issue

QuickProject.zip

To run the project:

  1. make tooling
  2. make project
  3. Run QuickProjectKitTests

What's the rest of the error? The message between the "Attempted to report a test failure to XCTest while no test case was running. The failure was:" and "It occurred at: [...]" lines. That'll help with determining what the actual issue is.

Yes, you are right that's how I live now, but it's very difficult compared to the previous behavior.

I uploaded a test project with the issue, please take a look.

I haven't looked at @Bogdan-Belogurov's example project, but I just got this unexpected behavior as well. Interestingly, I am also using Tuist.

This is caused by Nimble's CurrentTestCaseTracker.sharedInstance() not getting registered with XCTest. In particular, XCTestObservationCenter+Register.load's override isn't getting called.

Which appears to be caused by Tuist improperly handling Nimble's Package.swift (specifically, it looks like they're not including the NimbleObjectiveC stuff specified in our Package.swift). Until Tuist fixes this, I'd suggest following Tuist's documentation for using the native SPM integration.

I filed an issue with Tuist to hopefully get it resolved at some point.