Search code examples
iphonetestingsentestingkit

iPhone Unit Testing using SenTesting Framework


I have created a project and it works fine. Now I need to write some test cases. So I added and set up SenTestingKit. Then I started writing test cases by creating instances of a Class and trying to change value of some variables within that class. The problem is I have declared some variables as local (Default "protected"), and these variables could not be modified. So is there a way to test by changing instance var value without adding @property(nonatomic,retain) to each variable? Thanks in advance..


Solution

  • My aim was to modify instance variables without adding @property() to variables. I have done it by adding instance methods like

    -(void)setValueOfArrayCount:(int)newValue{
    
         arrayCount = newValue;
    }
    
    -(int)getValueOfArrayCount{
    
         return arrayCount;
    }
    

    And I could invoke these methods from out side this class.