Xcode 3.1.3 test module test module problems

After the Chris Hanson and Apple Blogs Automated Unit Testing with Xcode 3 and Objective-C I started implementing unit tests for my projects. However, I use many plugins (downloadable packages), and I cannot figure out how to test them.
I decided that I would use the approach described by Chris Hanson for testing frameworks. I started with the Cocoa Bundle project, added a main class, and changed the type to a plugin.
Then I added the unit test package, add the plugin as a direct dependency (Apple instructions) and set the following build options:

Package Loader: $ (BUILT_PRODUCTS_DIR) /CocoaPlugin.plugin/Contents/MacOS/CocoaPlugin
Host Testing: $ (BUNDLE_LOADER)

The problem is that as soon as I do this and create a test target, I get this message:

Error: test host '/Users/elisevanlooij/Documents/Plug-ins/CocoaPlugin/build/DebugCocoaPlugin.plugin/Contents/MacOS/CocoaPlugin' failed with code 127 (it may have crashed). [code 126 in another plugin]

I was hoping that adding a custom otest executable would help, but unfortunately not. I really hope that someone can help, because the unit test cannot, my plugin really puts a cramp on my lifestyle.

+3
source share
2

. Bundle Loader , unit-test.

, ( !), ( SenTestCase , ?).

, , , , ? , unit-test-bundle - API, , ?

. .

( , , ) , "" , Chris Hanson, . , .

- , , , unit-test. , .

, , , - , , , , , , , , , , Chris Hanson unit test , , - .

+2
  • : $(BUILT_PRODUCTS_DIR)/CocoaPlugin.plugin/Contents/MacOS/CocoaPlugin

    . , , , CocoaPlugin. /. (. -bundle_loader man ld)

  • Test Host: $(BUNDLE_LOADER)

    . ( NSApplicationMain, ), . TEST_HOST . :

    • TEST_HOST . , , initlaize.

    • test_host, , NSApplicationMain TEST_HOST.

+initalize :

+ (void)initialize
{
    NSBundle* bundle = [NSBundle bundleWithPath:pathToPlugin];
    [bundle load];
    NSLog(@"Loaded:%@\n",bundle);
}

- dummy_test :

int main(int argc,const char** argv)
{
  NSBundle* bundle = [NSBundle bundleWithPath:pathToPlugin];
  [bundle load];
  NSLog(@"Loaded:%@\n",bundle);
  return NSApplicationMain(argc,argv);
}

:

  • : BUNDLE_LOADER, TEST_HOST unittest.
  • unittest. SenTestingKit script TEST_RIG=/Developer/Tools/otest "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests".
+1

Source: https://habr.com/ru/post/1720876/


All Articles