0

我有一个动态变化的行数的pickerView。我想在主应用程序目标中从我的模型中选择这个计数。

例如,//测试目标

#import <KIF/KIF.h>
#import "SearchModel.h" //import class from main target

@interface Acceptance_Tests : KIFTestCase
@property (nonatomic, strong) SearchModel * searchModel;

@end

@implementation Acceptance_Tests

-(void)test_01_SearchWithConditions
{
    self.searchModel = [[SearchModel alloc] init];

    [tester tapViewWithAccessibilityLabel:@"Search Library"];
    [tester tapViewWithAccessibilityLabel:@"type_pickerView"];

    //choose type
    for(int i = 0; i < self.searchModel.types.count; i++)
    {
        [tester waitForTappableViewWithAccessibilityLabel:@"Search"];
        [tester selectPickerViewRowWithTitle:[self.searchModel.types objectAtIndex:i]];
        [tester tapViewWithAccessibilityLabel:@"Search"];
    }
}

当我执行 Cmnd+UI 时出现错误

 Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_SearchModel", referenced from:
      objc-class-ref in Acceptance_Tests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我也可以将 SearchModel.m 添加到测试目标中的 Compile Cources,但这意味着我必须将所有类添加两次(在主目标和测试目标中),mm。有什么想法吗?我可以通过其他方式访问主要目标中的类吗?

4

2 回答 2

0

测试,以及 KIF 测试,都捆绑为正在测试的主机应用程序的一部分。确保在项目的“构建设置”中的“链接”下的“捆绑加载器”和“测试”下的“测试主机”都设置为您的应用程序二进制文件。如果您已将 KIF 目标创建为“iOS 单元测试包”,则应默认设置。

于 2018-07-24T14:49:58.770 回答
-1

The compile error tells you what's wrong. You are running the KIF tests in x64 mode (check your architectures and valid architectures in build_settings. Do you have arm64 in there?) your target app probably doesn't have the same architecture settings.

To start, I would make sure the architecture settings are identical between your KIF test target and your app.

于 2014-12-17T02:08:49.090 回答