LoginSignup
0
0

More than 5 years have passed since last update.

Twitter iOS SDKに学ぶプライベートプロパティ/メソッドのテスト方法(Objective-C編)

Last updated at Posted at 2019-01-12

Twitter iOS SDKに学ぶプライベートプロパティのテスト方法

はじめに

Viewのテストで内部のプロパティが正常に設定されているかどうか検証したいが、
そのためにプロパティを公開したくない。

解決策

テストクラスに公開したい、プロパティやメソッドを定義します。

コード

Twitter iOS SDK
に実際のコード例があるので観てみましょう。


@interface TWTRVideoCTAView ()
// exposed for testing
- (void)handleDeeplinkButton;
@property (nonatomic, readonly) UIButton *CTAButton;
@end

...

@implementation TWTRVideoCTAViewTests

- (void)setUp
{

課題

Swiftの場合は不可能(別記事にて解決策を寄稿)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0