You need to sign in to do that
Don't have an account?
uu
Help me to write test class for following code.
Hii Developers,
Please help to write test class for this part of code.
code
Please help me
Thank you.
Please help to write test class for this part of code.
code
Income_Tax__c ITax=[select id,Rent_paid_to_landlord__c,Leave_travel_concessions_or_assistance__c,Employees_PF__c, Interest_payable_paid_to_lender__c,Children_s_Education_Fee__c,PPF__c,Insurance_Premium__c, NSC__c,Deduction_under_Pension_scheme__c,Housing_loan_principal_repayment__c,ELSS_Mutual_Fund__c, NPS__c,Payment_for_Medical_Insurance_Premium__c,Medical_treatment_for_handicapped__c, Medical_for_specified_diseases__c,Education_Loan_Interest_Repayment__c,Interest_on_loan_taken_for_house__c, Donation__c,Rent_deduction_only_if_HRA_not_received__c,Saving_interest__c,Rebate_of_Rs_2000__c,RGESS__c, Royalty__c,Professional_Development_Allowance__c,Car_Maintenance_Allowance__c, Conveyance_Allowance__c,Helper_Allowance__c,Telephone_Internet_allowance__c, Tax_by_previous_employer__c,TDS_already_deducted_by_Current_Company__c,Donation_to_Other__c from Income_Tax__c where id=:tax.id]; If(ITax.Rent_paid_to_landlord__c!=null){ Attachment a = new Attachment(parentid=tax.id, Name = 'Rent paid to landlord.jpeg' , Body = myfile.body); try {insert a;} catch(Exception ex){ ApexPages.addMessages(ex); return null; } } If(ITax.Leave_travel_concessions_or_assistance__c!=null){ Attachment a1 = new Attachment(parentid=tax.id, Name = 'Leave travel concessions or assistance.jpeg', Body = myfile1.body); try {insert a1;} catch(Exception ex){ ApexPages.addMessages(ex); return null; } } If(ITax.Interest_payable_paid_to_lender__c!=null){ Attachment a2 = new Attachment(parentid=tax.id, Name = 'Interest payable paid to lender.jpeg' , Body = myfile2.body); try {insert a2;} catch(Exception ex){ ApexPages.addMessages(ex); return null; } } If(ITax.Employees_PF__c!=null){ Attachment a3 = new Attachment(parentid=tax.id, Name = 'Employees Provident Fund.jpeg' , Body = myfile3.body); try {insert a3;} catch(Exception ex){ ApexPages.addMessages(ex); return null; } } If(ITax.Children_s_Education_Fee__c!=null){ Attachment a4 = new Attachment(parentid=tax.id, Name = 'Children Education Fee.jpeg' , Body = myfile4.body); try {insert a4;} catch(Exception ex){ ApexPages.addMessages(ex); return null; } }
Please help me
Thank you.
Like you can write test class for the following If statement
as follow
Lets say class to be tested is Tax Class and the test class for this is TestTaxClass
Like this write test class for all If condition.
If this solves you query. mark this as solved.
Thank you for ur reply.
I have written below code but still not working.
Please tell me what's wrong with this code.
Thank you.