I am new to programming. I am wondering what is the best way to set up a fairly long test conditions? Instead of writing a lot of if() else() statement, can I putting all the test conditions in a Plist file or a Dictionary so that i开发者_运维百科t is much more manageable?
Thanks
JenoWell let's look at the example
Example
plist containing some entries:
name(NSString*): Tom
age(int): 15
gender(NSString*): male
*Testing *
To test automatically I would put all my properties of an User object into an array.
userProperties = [@"Blake", 10, @"male"]
For every entry in userProperties array
if property at index i is equal to property at index i in plist
print YES
else
print NO
Note: you may have to check what type of class is an object so that you choose proper checkup function. Meaning for NSString you would use [NSString isEqualToString:@"string"]
and for int you would use ==
In short. It all depends on what you want to do.
精彩评论