+ Start a Discussion
MarrisMarris 

How to create person account in apex Test class

Hi

 

    I had a query in my class stated like this

 

   User user = select conatctid form User where id=:userinfo.getUserId();

   Account acc = Select mailingcity,mailingstate from account where personconatctID=:user.contactId();

 

  For this I have to write a test class. I dont know how to create a dummy person account  and assign it to User for testing

 

I have to test by creating a new person account and user to test the above Query how can i do this? 

 

Need a help on this....

 

Thanks

Marris.

Rahul SharmaRahul Sharma

Marris, Hope this helps

 

MarrisMarris

Hi rahul sharma

 

       I can create a person account by this link Please help me on how to create a user for test class with person account id/person contact id to test the methods in the class .

 

Thanks

Marris