2011-04-04 49 views

回答

-1

使您的單元測試目標取決於您的應用程序,以便您始終在單元測試之前構建應用程序。

然後,只需添加一個「setUp()」方法來啓動您的應用程序(並等待它啓動),然後再繼續。

  1. 檢查您的應用程序已經運行:

    的NSArray *應用= [[NSWorkspace sharedWorkspace] valueForKeyPath:@ 「launchedApplications.NSApplicationBundleIdentifier」]; BOOL myAppIsRunning = [apps containsObject:com.mycompany.myapp];

  2. 啓動您的應用程序(在設置()),並等待:

    [NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:com.mycompany.myapp選項:NSWorkspaceLaunchWithoutActivation additionalEventParamDescriptor:NULL launchIdentifier:無]。 (![self isRunning])//見上面 { sleep(1); }

2

做產品 - >編輯格式... - >參數 - >環境變量,然後設置GHUNIT_AUTORUNYES

+1

您先生,應該受到表彰。謝謝! – mccrackend 2013-02-01 02:50:50

相關問題