i have a class which queries for sales for last year and updates a field in another object.
How can i assert this value in my test class? This data would not be dependent on my test data as the environment could contain previous records other than my test data.
thanks
If you update your class to use the latest API version (as of Spring 12) then you’ll find that there are now restrictions in place so that test methods can’t access any data except for that which they’ve created. Not only does this help massively in scenarios such as the one you’ve described (where you want to be sure it uses certain data) but it also enforces best practice and means tests will always run properly when deploying to another environment.