You need to sign in to do that
Don't have an account?

tets case help
i have 3 queries in my controller i am able to cover the first query but not able to cover the contact and account queries please look at the queris and help how to cover them
u = [Select id,name ,LastName,FirstName,ContactId,Profile.Name from user where id=:UserInfo.getUserId()];
Con=[select id,lastname from Contact where id =: u.ContactId];
Ac = [select id,lastname from Account where PersonContactId =: con.Id];
Are your test runs succesfull if not can you put the test results .. here ?
this is the test case i have writtena nd i am getting this error
invalid cross reference key
On which line you are getting this error ?
here i am getting the error plz check the link
http://boards.developerforce.com/t5/General-Development/test-case-help/td-p/438829
Ok so i got your problem
PersonContactId is NULL in your case
1.) Create test data for user, Contact and account with PersonContactId as id of contact you have created it will solve your problem
testMethod static void testWebSrvceAddNumbers()
{
contact c=new contact();
c.ts2__Lastname__c='dds';
c.LastName='dds';
c.accountid=a.id;
c.CurrencyIsoCode='INR';
insert c;
account a =new account();
a.PersonContactId=c.id;
a.Preferred_Delivery_Address__c='Home';
a.E_mail__c='arora.abhay@gmail.com';
a.name='dsds';
//a.ts2__Lastname__pc='dds';
insert a;
Opportunity objNewOpp = new Opportunity(Name ='Test',CloseDate=System.today(),Stage='Initial',A
ccountId =a.Id);
insert objNewOpp;
Profile p = [select id from profile where name='Customer Portal Manager Custom'];
User u = new User(alias = 'standt', email='standarduser@testorg.com',
emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US',
localesidkey='en_US', profileid = p.Id, contactid=c.id,
timezonesidkey='America/Los_Angeles', username='standarduser@testorg.com');
// user u = [Select id,name ,LastName,FirstName,ContactId,Profile.Name from user where id=:UserInfo.getUserId()];
system.runas(u)
{
account a1 =new account();
a1.Preferred_Delivery_Address__c='Home';
a1.E_mail__c='sandeep@tvarana.com';
a1.name='dds';
//a1.PersonContactId=c.id;
insert a1;
MyChecklist_All m=new MyChecklist_All();
}
}
}
Above will solve your problem
HI
Personcontact id is not a writeable field this is the error i am getting what should i do now