objective c - How to test class methods using OCMock -


i wonder if there way using ocmock can invoke class method twice separately if app runs 2 times, in fact, once.

i want test class method. due static variables inside method, method keep behavior time once it's called. can't test different behaviors @ 1 time.

and of course, can't add else class if purpose testing.

there not way alter statically declared variables ocmock without exposing them via objective-c methods. "of course" can't add class testing purpose, not universally accepted. there entire school of thought believes code should designed tested.

- (nsinteger)somestatic {     static nsinteger _somestatic = 42;     return _somestatic; } 

if used pattern that (for example, there may better ones) mock static. while add method call anywhere static used, may find more important have comprehensive testing.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -