我在单元测试方面遇到问题。当我运行测试时,它以 "No tests found"
结束。
我正在使用 AppCode
和 Quick/Nimble
框架进行单元测试,但它在 XCode 中也不起作用。
我有 XCTest/Kiwi
运行配置,目标:MyAppTests,配置:开发和类:所有测试类(即使指定了特定的测试类,它也不起作用)。
据我所知,没有更多的配置。
知道我做错了什么吗?我不确定我应该提供哪些其他类型的信息/配置。谢谢
编辑: 示例单元测试代码
import Quick
import Nimble
@testable import FigurePOS
class DateFormatterTest: QuickSpec
{
override func spec()
{
describe("formatting dates") {
it("should print correct date") {
var c = DateComponents()
c.year = 2016
c.month = 5
c.day = 24
c.hour = 4
c.minute = 33
c.second = 12
let gregorian = NSCalendar(identifier: .gregorian)!
let date = gregorian.date(from: c)!
expect(DateFormatter.formatGmt(date)).to(equal("2016-05-24T04:33:12Z"))
}
}
}
}
最佳答案
我也使用 Quick
+ Nimble
。代码对我来说看起来不错。
我的猜测是该类未被编译。您可以转到 Targets
> AppTests
> Build Phrases
。确保 DateFormatterTest
在 Compile Sources
中。
关于ios - 单元测试(快速/灵活)-(未找到测试),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40587843/