在Swift中怎么测试UIAlertController方法
1个回答
2016-01-16
展开全部
测试的代码如下:
import XCTest
@testable import TestingAlertExperiment
class TestingAlertExperimentTests: XCTestCase {
var sut: ViewController!
override func setUp() {
super.setUp()
sut = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as! ViewController
UIApplication.sharedApplication().keyWindow?.rootViewController = sut
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
}
import XCTest
@testable import TestingAlertExperiment
class TestingAlertExperimentTests: XCTestCase {
var sut: ViewController!
override func setUp() {
super.setUp()
sut = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as! ViewController
UIApplication.sharedApplication().keyWindow?.rootViewController = sut
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询