iOS单元测试和UI测试全面解析(30)

发表于:2017-03-31来源:51CTO作者:朱先忠点击数: 标签:单元测试iOS
ReleasetheSUT and themockobject in tearDown(): controllerUnderTest=nil mockUserDefaults=nil Replace testExample() with this: //Mock to testinteraction with UserDefaults functestGameStyleCanBeChanged()
  • Release the SUT and the mock object in tearDown(): 
  • controllerUnderTest = nil 
  • mockUserDefaults = nil 
  • Replace testExample() with this: 
  • // Mock to test interaction with UserDefaults 
  • func testGameStyleCanBeChanged() { 
  •   // given 
  • 原文转自:http://mobile.51cto.com/iphone-535758.htm