首页 > 解决方案 > Cannot run individual method tests

问题描述

I have an Objective-C project I'm working on where I am integrating Swift. Right now I cannot run individual tests for the Objective-C tests that was possible before. If I check one of the diamond play buttons for an individual test it runs the tests for the whole class. Is there a way to fix this?

For the Swift tests that were integrated I used Quick & Nimble so I don't know if those libraries could have affected this.

标签: objective-cswiftunit-testingtestinginterop

解决方案


@Sahil Reddy

您的问题可能与Quick有关。

有一个开放的 PR旨在解决这种单一的测试用例选择行为。从 PR 描述:

当要求非 Quick 类选择性地测试时,例如SomeClass/some_specific_function使用生成套件的默认行为QuickTestSuite将导致它执行每个测试功能,而不仅仅是选定的功能。

不幸的是,似乎没有任何解决方法。

我想出的唯一办法是重写这些测试以使用 Quick,然后使用焦点前缀 ( fit, fcontext, fdescribe) 单独运行您感兴趣的示例或组。这是为了一点点额外的工作,您可能必须等到修复程序被合并和发布,我知道这可能会令人沮丧。


推荐阅读