You need to sign in to do that
Don't have an account?
I got this error when i save my test class. Constructor not defined: [recordExt].<Constructor>()
here is my class..
@IsTest
public class TestrecordExt{
static testMethod void TestEmp(){
//test.startTest();
List<employee__c> eList = new List<employee__c>();
employee__c e = new employee__c();
e.Name = 'test';
e.Last_Name__c = 'test';
e.Join_Date__c = Date.Today();
e.City__c = 'test city';
e.Phone__c = '123456';
eList.add(e);
e = new employee__c();
e.Name = 'employee Name';
e.Last_Name__c = 'emp Last Name';
e.Join_Date__c = Date.Today();
e.City__c = 'test city';
e.Phone__c = '123456';
eList.add(e);
insert eList;
recordExt r = new recordExt();
r.saveEmp();
//test.stopTest();
}
}
@IsTest
public class TestrecordExt{
static testMethod void TestEmp(){
//test.startTest();
List<employee__c> eList = new List<employee__c>();
employee__c e = new employee__c();
e.Name = 'test';
e.Last_Name__c = 'test';
e.Join_Date__c = Date.Today();
e.City__c = 'test city';
e.Phone__c = '123456';
eList.add(e);
e = new employee__c();
e.Name = 'employee Name';
e.Last_Name__c = 'emp Last Name';
e.Join_Date__c = Date.Today();
e.City__c = 'test city';
e.Phone__c = '123456';
eList.add(e);
insert eList;
recordExt r = new recordExt();
r.saveEmp();
//test.stopTest();
}
}
You did not define the default Constructor in your controller.
Create a Constructor in your controller like below.
public recordExt(){
}
All Answers
You did not define the default Constructor in your controller.
Create a Constructor in your controller like below.
public recordExt(){
}
You have used the same instance name for insertion in the custom object. The instance name should be different while doing insertion in the object.
I have made some changes in the code. Please see below for details.
Please mark as best answer if it helps you.
Regards,
Grazitti Team,
www.grazitti.com