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

How to write Test Class
Hi everyone,
I need help to write a test class for my code, actually i'm new to this if anyone know please help me. Below is my code
I need help to write a test class for my code, actually i'm new to this if anyone know please help me. Below is my code
public class TestController { public Map<String, String> prodCounts{get; set;} public List<String> prods{get; set;} public String poNo; public String getpoNo(){return poNo; } public void setpoNo(String po) { poNo = po; TestController(); } public void TestController() { prodCounts=new Map<String, String>(); prods=new List<String>(); for(AggregateResult ag:[select Product2__c prod, count(Id) cnt from test_transaction__c where Po_num__c=:poNo group by Product2__c]){ prodCounts.put(String.ValueOf(ag.get('prod')),String.ValueOf(ag.get('cnt'))); prods.add(String.ValueOf(ag.get('prod'))); } } }
See if this link helps!!
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_qs_test.htm