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

test class remont action
some one can help me how to test this method
My Controller Code:
Please help me.
Thanks in Advance
My Controller Code:
... @RemoteAction
public static List<JSStove> getStoves(Id ResellerID) {// include Id ResellerID from VF
List<JSStove> stoves = new List<JSStove>();
for (Product_item__c stove : [SELECT Id, Name FROM Product_item__c
WHERE Reseller__c =:ResellerID ORDER BY Name ASC]) {
stoves.add(new JSStove(stove.Name, stove.Id));
}
return stoves;
}
public static List<JSStove> getStoves(Id ResellerID) {// include Id ResellerID from VF
List<JSStove> stoves = new List<JSStove>();
for (Product_item__c stove : [SELECT Id, Name FROM Product_item__c
WHERE Reseller__c =:ResellerID ORDER BY Name ASC]) {
stoves.add(new JSStove(stove.Name, stove.Id));
}
return stoves;
}
Please help me.
Thanks in Advance
All Answers
I have gave very basic code to cover your method.
Hope this helps.
@isTest
public class MyControllerTest {
@isTest
public void getStovesTest(){
//Create a Product_item__c record
//give the necessary details
Product_item__c testRecord = new Product_item__c();
//give the resellerId of the record you created above
MyControllerTest.getStoves(resellerId);
}
}
Regards,
Mohan
Please check once below sample code:
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Salesforce Freelance Consultant/Developer/Administrator/Trainer
@For Salesforce Project Support: varaprasad4sfdc@gmail.com
Salesforce latest interview questions and training videos :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1
it work but at the end it have error
Compile Error: Invalid type: JSStove
can you explain
Regards,
Andri