1

I am trying to deploy a few classes. I've got a Sandbox that I literally created this morning off of Production. Nothing is different between the two except the 3 classes I'm deploying.

How can it possibly happen that an unrelated Test in the org passes in BOTH environments pre-deploy, yet somehow magically fails during validation? Here's a debug snippet of the first occurrence of the exception:

17:22:03.392 (5395258016)|CODE_UNIT_FINISHED|CampaignTrigger on Campaign trigger event AfterUpdate|__sfdc_trigger/CampaignTrigger
17:22:03.399 (5399758426)|CODE_UNIT_FINISHED|Workflow:Campaign
17:22:03.399 (5482111461)|METHOD_ENTRY|[56]||System.Test.stopTest()
17:22:03.497 (5497726340)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5498236120)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5498309414)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5498439134)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5506792563)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5506832290)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5506873375)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5506944995)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507120013)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507138315)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507148965)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507207035)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507458722)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507475887)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507484078)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507752219)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507771400)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507812433)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507832516)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507844364)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5507981794)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5508084692)|ENTERING_MANAGED_PKG|cbit
17:22:03.497 (5572806434)|ENTERING_MANAGED_PKG|cbit
17:22:03.399 (5776191483)|METHOD_EXIT|[56]||System.Test.stopTest()
17:22:03.399 (5776269192)|FATAL_ERROR|System.UnexpectedException: No more than one executeBatch can be called from within a test method.  Please make sure the iterable returned from your start method matches the batch size, resulting in one executeBatch invocation.

External entry point
17:22:03.399 (5776318677)|FATAL_ERROR|System.UnexpectedException: No more than one executeBatch can be called from within a test method.  Please make sure the iterable returned from your start method matches the batch size, resulting in one executeBatch invocation.

There is no call to executeBatch() in any of my code, so I can only deduce that it's the managed package. But even so, how can this even happen if the same test (unrelated to the code I'm otherwise deploying) passes in both the Sandbox and Production pre-deploy??

...this is clearly how I wanted to spend my Friday -_-

  • @sfdcfox It's my test, not theirs. It's triggering their code (evidently). – Mike Sep 22 '18 at 1:05
  • Are you using @isTest(SeeAllData=true) in any of your tests, or otherwise inserting/updating 201+ records? – sfdcfox Sep 22 '18 at 1:06
  • @sfdcfox In this case, yes, because I have to... The test involves defaulting custom CampaignMemberStatus records, which are only visible to tests with that annotation. – Mike Sep 22 '18 at 1:07
  • 2
    Are you deploying new trigger logic, or new logic in a trigger handler? New Process Builders or Flows? There's a number of reasons the test itself might fail despite being identical, but it comes down to a different code path somewhere. – sfdcfox Sep 22 '18 at 1:29
  • 1
    @sfdcfox I'm deploying changes to Test classes only, to fix other issues this same managed package was causing. EDIT mid comment - I removed the ad-hoc "fix" they had sent me to "disable" their code (involved sending a JSON object to some Controller class in their package) and I'm no longer getting the exception. That confirms it's their code. Ironically, it's the workaround code intended to fix another issue that's causing another problem... – Mike Sep 22 '18 at 1:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.