ios - How to test a method with XCTestCase in Objective C which does not return a value -
i practicing unit test cases in xcode. have method in controller class has lines of code method not return value. confusion how can write test case function type of method. below method need write test case function. can please me understand how this? in advance.
_bool isvalid = true; _struseremailedited = @"abc@test.com"; _strpasswordedited = @"123456789"; if ([_strpasswordedited isequaltostring:@""] || [_struseremailedited isequaltostring:@""]){ if ([_strpasswordedited isequaltostring:@""]) { _lblerrorpassword.text = @"password required."; }else{ _lblerroremail.text = @"email required."; } isvalid = false; } if ([_strpasswordedited isequaltostring:@""] && [_struseremailedited isequaltostring:@""]){ nslog(@"please,enter values"); _lblerrorpassword.text = @"password required."; _lblerroremail.text = @"email required."; isvalid = false; } else { // validation check emailid if ([_struseremailedited length]==0){ _lblerroremail.text = @"email required."; isvalid = false; } else if (!_struseremailedited.isvalidemail) { // check valid emailid _lblerroremail.text = @"please enter valid email address."; isvalid = false; } else if (_struseremailedited.isvalidpassword){ _lblerroremail.text = @""; isvalid = true; _lblerroremail.text = @""; } // check valid password if ([_strpasswordedited length]==0){ _lblerrorpassword.text = @"password required."; isvalid = false; }else if (!_struseremailedited.isvalidpassword) { isvalid = false; _lblerrorpassword.text = @""; }else if([_strpasswordedited length]>=1 && _struseremailedited.isvalidemail){ _lblerrorpassword.text = @""; isvalid = true; }else{ isvalid = false; _lblerrorpassword.text = @""; } } if (isvalid==true){ }
wiki
Comments
Post a Comment