You need to sign in to do that
Don't have an account?
Patrick Maxwell Appfolio
Conditional Statements Referencing Related Object on Batch Job Not Working in Testing
First off, sorry for the long title, but I couldn't' think of a way to shorten it.
Currently I have a test class that creates accounts, users, and tasks that are all related to each other.
I have a batch class that I'm trying to test which queries tasks and has custom logic to populate a custom field based on values related to the task. Some examples of fields I'm making conditional statements agains are Owner.ProfileId, and Account.RecordtypeId.
It seems that no matter what I do, when I call the batch class from my test class, all those related fields are NULL. There isn't even an OwnerId or AccountId value on the task anymore. I can provide code samples, but I don't want to include them until someone (anyone?) can direct me on what to provide, so I'm not just putting an entire class in here that is a huge eyesore.
Currently I have a test class that creates accounts, users, and tasks that are all related to each other.
I have a batch class that I'm trying to test which queries tasks and has custom logic to populate a custom field based on values related to the task. Some examples of fields I'm making conditional statements agains are Owner.ProfileId, and Account.RecordtypeId.
It seems that no matter what I do, when I call the batch class from my test class, all those related fields are NULL. There isn't even an OwnerId or AccountId value on the task anymore. I can provide code samples, but I don't want to include them until someone (anyone?) can direct me on what to provide, so I'm not just putting an entire class in here that is a huge eyesore.