+ Start a Discussion

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
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;
    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]){