You need to sign in to do that
Don't have an account?
Test Class
Hi to All,
please write test class for this, its urgernt.
public with sharing class controlll {
public cont__c co;
public string country;
public string transactionid;
public string cardtype;
public controlllApexPages.StandardController controller)
{
pc = (cont__c)controller.getrecord();
}
public pagereference p1(){
if(pc.country__c == 'United States')
{
country ='US';
asdf3 c = new asdf3();
p.city = pc.city__c;
p.state = pc.state__c;
insert pc;
}
else
{
if(pc.country__c == 'Aus')
{
country ='AU';
asdf4 p = new asdf4();
p.city = pc.city__c;
p.state = pc.state__c;
insert pc;
}
}
pagereference p4 = page.successpay ;
p4.getParameters().put('transid', transactionid);
return p4.setredirect(true);
}
public cont__c getp(){
return pc;
}
thanking you adavance ,
Are you getting any error / poblem while writting the test class for above code ?
@IsTest(SeeAllData=true) public static void testcontrolll() {
// Instantiate a new controller with all parameters in the page
controlll obj = new controll();
obj.country = 'INDIA';
obj.transactionid = '4455660018567896';
obj.cardtype = 'qwerty';
obj.p1();
System.assertEquals(obj.p1(),null);
i written test class like this, but it covers only 12%
am new to test class, please help me hou to write the remaining testmethod, with code