开发者

IOS setting up and loading multiple/long test conditions

开发者 https://www.devze.com 2023-03-03 02:50 出处:网络
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 Plis

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

Jeno


Well 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消