You need to sign in to do that
Don't have an account?
Mitch McConnell
Too many SOQL queries and Apex tests
I know there are many answers to the "too many" part of this question, and I understand the reason and the normally suggested solutions.
But I believe I see this behavior change even running the same test on different occasions, i.e., with no code changes sometimes it will get this error, and sometimes not.
Does this seem possible? Has anyone else experienced this?
And yes, I have (many times) tried most of the suggested solutions.... so this is more of a "is this really possible?" question.
It is same method giving differnet behavior then it might be possible there were changes made in your salesforce org components which are a part of execution flow of that test class. for example Trigger, class or workflow etc.
Please let me know what condition were when you run same test method two times.
Thanks
Sandeep Singhal
All Answers
When you run a particular test method it depends on it's nature that what part of your class it is covering up and accordingly your code flow gets executed. so it might be possible to run different - 2 execution for different test methods so some may cause too many SOQL some may not.
If you need further clarification please let me know.
Thanks
Sandeep Singhal
http://www.codespokes.com/
Sandeep,
I am talking about the same method seemingly having different behavior, with no code changes. I know it
doesn't make sense, but it sure seems like I have experienced this...
It is same method giving differnet behavior then it might be possible there were changes made in your salesforce org components which are a part of execution flow of that test class. for example Trigger, class or workflow etc.
Please let me know what condition were when you run same test method two times.
Thanks
Sandeep Singhal
Is your test class is creating its own test data or are you fetching data from system. If seeAllData true and you are using system data then there is a chance that too many SOQL depend on the data coming from system in differrent execution and so sometine issue will come and sometime not.
I would suggest you to keep seeAllData= false in your test class.
Thanks,
Vishal
Sandeep, thanks for taking the time to reply. I know this does not make sense. This is in a sandbox that I am the sole
developer on... I am guessing that I will simply have to review each trigger and the code being executed to find this, but this
is extremely complex... far too much to try and post anything... Thanks.. Mitch
and Vishal's suggestion would help you also.
Thanks
Sandeep Singhal
sandeep.salesforce
http://www.codespokes.com/