You need to sign in to do that
Don't have an account?
sangeeta.marathe@Futurewise.co
test class
i am inserting values using test class
the Query is executing properly in my system log but when i am executing the entire class it is giving me the following error
LIST HAS NO ROWS FOR ASSIGNMENT TO SOBJECT
Do you have an example of the code you are running for it to be looked through? It seems that the objects have not been created properly or you have not inserted them as is needed (no data is commietd to the database during test but you can still "insert" records for testing purposes.
Seeing the code would make it easier.
Paul
The error is giving me the description as error in my DatabaseQuery class where i have defined a method
In th method i am fetching the custom setting record fields depending on the account name
My test class the following code
Account acc=new Account(LastName='parent',PersonMailingStreet='Street',PersonMailingCity='City',
PersonMailingState='state',PersonMailingCountry='country',
PersonMailingPostalCode='123456',FirstName='DEF',Retirement_Age__c='55',
Estimated_Life_Expectancy__c='85',PersonBirthdate=system.today(), RecordTypeId='01220000000DnK3AAK');
upsert acc;
system.assertNotEquals(null,acc);
Apexpages.currentPage().getParameters().put('entityId',acc.id);
Account child=new Account(LastName='PQR',FirstName='MNO',Parent_Entity__c=acc.id,RecordTypeId='01220000000HZ0HAAW');
upsert child;
system.assert(child!=null);
}
I am not able to undersntand y are they using 2 recordtype ID's
the Id's are also passes as child.id
Firstly you should not hard code IDs into tests for RecordTypes or anything. It is the worst of worst practices and the tests will undobtedly fail when you install the app in another org.
You have posted the code doing the insertion but not given any information on what line it is failing on or where the error is appearing, only what the error is. You seem to have no assertion or SOQL string that would cause this error in the code you have included, and the 2 asserts in there are meaningless, you have already ensured it is non-null about 4 lines up when you set a value. Essentially your code there is testing that you can create a new object and that Apex has managed to interpret that commend correctly.
Please provide more information.
Paul
Account account=new Account();
dmlobj=new DatabaseDML();
Apexpages.currentPage().getParameters().put('RecType',Label.client);
ApexPages.StandardController stdController= new ApexPages.StandardController(account);
fmInfoCon=new FamilyMemberInfoContoller(stdController);
fmDetailCon=new FamilyMemberDetailController(stdController);
this is the code that i have created.
I am getting error on this method.
The issue is you are passing a blank empty account into the standard controller (it needs to be an account with a valid id) otherwise it will not work.
Is it happening bcoz i have not run the trigger.......
I have tried every possible thing that i know but still now able to crack it......
My test class is not executing bsoz of it....
It world b great if somebody could help....
In your code here
I have added some comments to your code but your error is the fact that Account account = new Account() creates a blank empty account and so calling the standard controller constructor on it will cause an error as there is no data in that account. You need to retrieve an account from the database to pass into the standard controller constructor.