XCUITest Failure - Error: activate application (current state: Running Background)

On XCode 12.0.1, I have this intermittent error, is there any way to fix this?

	t =     0.19s Open <bundle_id>
    t =     0.29s     Launch <bundle_id>
<unknown>:0: error: -[<test_name>] : activate application '<XCUIApplicationImpl: 0x600000842d00 <bundle_id> at <app_path>' (current state: Running Background)
    t =    61.11s         Setting up automation session
    t =    61.13s         Wait for <bundle_id> to idle
   

The test continues running for a while, but it failed because of the error during the launch step (0.29s - 61.11s).

Also, notice an unexpected long launching here, it normally just takes 10-15s for this step.

Thanks

Can you try this with the most recent version of Xcode? What platform / OS is this on? Have you tried disabling the debugger in the Test action of your scheme? If you're still seeing this in recent versions of Xcode, please file a Feedback Report if you can, and attach the result bundle from a run that failed like this.

XCUITest Failure - Error: activate application (current state: Running Background)
 
 
Q