You need to sign in to do that
Don't have an account?
Jonathan Crow 10
Apex Test Class - When I don't use @istest(SeeAllData=true) I don't get any results back
I am trying not to use (SeeAllData=true), but when I don't use it the test returns no data. When I try to insert data into the record I get an error message that the field cannot be written.
Is there a way around this?
Is there a way around this?
If you do not use "@istest(SeeAllData=true)" and query the records in test class it will not return any details as test class wont have access to records. As you did you have to create the data in test class.
You highlited that you are getting error called "field cannot be written." it may be because the field may be formula field or auto number . You no need to insert the data with that field it will autocalculate when the record is inserted.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
please share your main class.