testmethod that publishes platform events – GACK 255731747

By | July 12, 2018

Use case:

  • Testmethod that invokes a service with more than 200 Sobjects
  • Service does work on each Sobject and as a side effect, also publishes Platform Events
  • By varying the number of Sobjects, at some point, the testmethod fails with an internal server error (gack) with error code 255731747. No other exception thrown or caught.

What is the cause?