简体   繁体   English

子类化XCTestCase子类:Test Navigator不显示所有测试

[英]Subclassing XCTestCase subclasses: Test Navigator does not show all tests

I'm new to subclassing XCTestCase on multiple levels, but was curious to trying it out since it could potentially save me lots of time rewriting tests, so I set up a simple hierarchy of classes in my testing target: 我很想在多个级别上继承XCTestCase,但很想尝试它,因为它可能会节省我很多时间重写测试,所以我在我的测试目标中设置了一个简单的类层次结构:

BaseSpriteNodeTests : XCTestCase
 -> CharacterTests : BaseSpriteNodeTests
 -> -> EnemyTests : CharacterTests
 -> -> PlayerTests : CharacterTests

I gave BaseSpriteNodeTests two simple test methods: testCreation and testDestroy , to see the how inheritance is handled inside test targets. 我给BaseSpriteNodeTests两个简单的测试方法: testCreationtestDestroy ,以了解如何在测试目标内处理继承。

When I Cmd+U all the tests, the console output is expected. 当我Cmd+U所有测试时,控制台输出是预期的。 (4 total classes, two methods each, 8 tests total) (总共4个班,每个两个方法,总共8个考试)

Test Suite 'All tests' passed at 2015-09-21 09:43:46.396.
     Executed 8 tests, with 0 failures (0 unexpected) in 0.217 (0.225) seconds

However, the Test Navigator is only showing 7 tests: 但是,Test Navigator仅显示7个测试:

测试导航器

Is this a bug in Xcode, or am I missing something crucial about subclassing XCTestCase subclasses? 这是Xcode中的一个错误,还是我遗漏了关于子类化XCTestCase子类的重要事项?

See my answer here - try deleting DerivedData. 在此处查看我的答案 - 尝试删除DerivedData。

I believe this is indeed an Xcode bug. 我相信这确实是一个Xcode错误。 Test Navigator, like a few other Xcode features, has a tendency to fall out of step with reality as changes are made. 与其他一些Xcode功能一样,Test Navigator随着更改而倾向于与现实脱节。 The only way to recover is to force a rebuild of the relevant index files/memory. 恢复的唯一方法是强制重建相关的索引文件/内存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM