function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
claperclaper 

Problem accessing hierchy field on Apex Test Class

The other day I was writting my test class to pass a custom controller for a VF page in to production. The VF page worked great everything as supposed to; returning right amount of rows and values. BUT then went I try to create my test class, i came accross the hierarchy field where not able to be used in the query (that's what i think it is)  listSize was always 0 in the test method when it was supposed to be 2. i try several ways but the same situation came accross...

 

any thoughts???

AnnuAnnu

Please refer this :http://astreait.com/starting-with-spring-12-apex-test-cases-will-not-have-access-to-org-data/. you cannot access your org data in ur test class.

 

Thank you

Annu.

claperclaper

thanks Annu for you responce. I did read the article, also the release notes for summer '12. As you can see in my code, I created all my test data myself in the class. Both the users I'm using and also the records I'm retrieving in the query.

 

but thanks again for a quick responce!