Tag: unit testing

XCodeunit testing

我从来没有使用unit testing,我理解它的用途,但我不知道何时以及如何使用它。 我想知道什么时候使用unit testing是值得的,也许有一些例子。

当ViewController从UIStoryboard实例化时,isMemberOfClass返回no

我有一个OCUnittesting类:PatientTestViewControllerTests。 以下是界面: @interface PatientTestViewControllerTests : SenTestCase @property (nonatomic, strong) PatientTestViewController *testController; @end 和setUp: – (void) setUp { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Testing" bundle:nil]; self.testController = [storyboard instantiateInitialViewController]; } “testing”故事板是我应用程序中唯一的故事板,并被设置为应用程序的主要故事板。 PatientTestViewController被设置为故事板唯一的视图控制器。 我在testing课上有一个testing: – (void) testInitialTestingStoryboardViewIsPatientTest { STAssertTrue([self.testController isMemberOfClass:[PatientTestViewController class]], @"Instead of the %@, we have %@",[PatientTestViewController class], [self.testController class]); } 此testing失败并显示以下日志消息: 错误: – [PatientTestViewControllerTests testInitialTestingStoryboardViewIsPatientTest]:“[self.testController isMemberOfClass:[PatientTestViewController […]

在Xcode 7中更改+加载方法的顺序

我发现Xcode 7(版本7.0(7A220))在unit testing中改变了调用类和类的+load方法的顺序。 如果属于testing目标的类别实现了一个+load方法,那么现在在最后调用该类时,该类的实例可能已经被创build和使用。 我有一个AppDelegate ,它实现+load方法。 AppDelegate.m文件还包含AppDelegate (MainModule)类别。 此外,还有一个unit testing文件LoadMethodTestTests.m ,它包含另一个类别 – AppDelegate (UnitTest) 。 这两个类别也实现+load方法。 第一类属于主要目标,第二类属于testing目标。 码 我做了一个小testing项目来演示这个问题。 这是一个空的默认Xcode一个视图项目,只有两个文件被更改。 AppDelegate.m: #import "AppDelegate.h" @implementation AppDelegate +(void)load { NSLog(@"Class load"); } – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSLog(@"didFinishLaunchingWithOptions"); return YES; } @end @interface AppDelegate (MainModule) @end @implementation AppDelegate (MainModule) +(void)load { NSLog(@"Main Module +load"); } @end […]

.NET的unit testing运行器

有没有人写过(或了解).netunit testing运行器, 在 NUnit上运行的优先级? 还是我必须推出自己的? 我的目标是在模拟器或设备上执行unit testing。 到目前为止,我已经看到了嘲讽monotouch.dll(但在PC上运行testing)的一些post/博客和一个答案,指出缺乏这样的工具。