How to Write Unit Test Class ?
Apex Class :
public class TestClassUnit{
public Account account{get;set;}
public TestClassUnit(){
account = new Account();
}
public void SAVE(){
account = new Account();
account.Name = 'Test Account';
account.Phone = '9426990685';
account.Industry = 'Engineering';
account.date__c = system.Today();
insert account;
}
}
Test Class for above mention Apex Class :
@isTest
private class TestClassUnitTest{
/* Create Method for Test */
Static testMethod void myUnitTest() {
/* Create Instance of your Class */
TestClassUnit Tc = new TestClassUnit();
/*Call Method from class*/
Tc.SAVE();
}
}
public class TestClassUnit{
public Account account{get;set;}
public TestClassUnit(){
account = new Account();
}
public void SAVE(){
account = new Account();
account.Name = 'Test Account';
account.Phone = '9426990685';
account.Industry = 'Engineering';
account.date__c = system.Today();
insert account;
}
}
Test Class for above mention Apex Class :
@isTest
private class TestClassUnitTest{
/* Create Method for Test */
Static testMethod void myUnitTest() {
/* Create Instance of your Class */
TestClassUnit Tc = new TestClassUnit();
/*Call Method from class*/
Tc.SAVE();
}
}
No comments:
Post a Comment