[英]Performance testing in Swift using TDD
刚学习Swift
Test Driven Development
。我在“ProjectNameTests”组中创建了一个类XCTestCase
子类。
class BasicFunctionTest: XCTestCase {
var values : [Int]?
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
for i in 1...100000{
println("ok i need to know the time for execution")
}
}
}
}
我想对这些方法进行性能测试
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
for i in 1...100000{
println("ok i need to know the time for execution")
}
}
}
并且想要找出执行for
循环的时间。我在转到Product - > Perform Action - > Test Without Building时运行项目。
我可以看到执行时间为3.50秒但是当我尝试设置基线点击笔划区域时,如下图所示:
我得到了警告
是否要更新所有设备上所有测试的基准值? 下次您提交源代码管理时,您将有机会查看更改。
现在,当我点击更新时,错误如下:
如何为我的特定方法设置基线时间为此处
这是我的测试项目: https : //drive.google.com/file/d/0Bzk4QVQhnqKmUzYyclp6ZnJvekE/view?usp =sharing
您能否检查BasicFunctionTest文件目标成员资格是否包含您的测试目标。 您应该能够通过选择文件并导航到文件检查器(目标成员资格)来检查这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.