I just got this error when trying to deploy new components to Prod. It's happening on Apex test classes that already exist in Prod, not new ones in my change set. I understand that this error relates to a new governor limit that was introduced in the Winter '14 release. What's the best approach for me to go about addressing this in order to commit my change set?
The Maximum CPU time on the salesforce servers - 10,000 milliseconds (Synchronous limit) 60,000 milliseconds(Asynchronous limit).
You may have to go in and edit and refine some of your code, This may be a good place to start.
I'm retracting what I said earlier about a query in a for loop..
"Operations that don’t consume application server CPU time aren’t counted toward CPU time. For example, the portion of execution time spent in the database for DML, SOQL, and SOSL isn’t counted, nor is waiting time for Apex callouts."
Please check what is consuming your CPU time.
I have posted the following in another post related to CPU time issues. So copy pasting her as I see the relevance.
I suggest to check your process time on queries and loops. Check the same in trigger as well.
add a statement before your query(s) and after it and also before the loop(s) and after them to see what is eating up most of the time. Following is the example:
Long queryStartTime = DateTime.now.getTime();
--your query statements and logic here
Long queryEndTime = DateTime.now.getTime();
--now check the time it is taking
System.debug(LoggingLevel.ERROR, 'Query time taken: ' + (queryEndTime - queryStartTime ));
You may find your problem with this. If not write back.