You need to sign in to do that
Don't have an account?

How to write a test class for below example for loop??
public void Save() { insert pat; for(wrapperservay wl : wrp) { Answer__c ua = new Answer__c(); //From here code is not covered. ua.Name = wl.Name; ua.Questionn__c = wl.QuestionId; useranswers.add(ua); insert ua; pat=new Answer__c(); }
Please help guys from this problem
Thanks in Advance,
Sandeep
For above for loop you need to create test data according to wrapper class
I would recommend building a list of answer__c records then do the dml statment on the list to avoid hitting dml limits.