I have an CI system using Jenkins and the metadata API to automatically execute all unit tests in our packaging org. Some, but not all, of the unit tests have started failing at the point where the test methods make a call to system.test.startTest()
. The error is
"System.FinalException: Method only allowed during testing stack (System Code)"
Seems pretty nonsensical since the context is most definitely a unit test class and test method. The same unit tests that fail when executed via metadata API are executing/passing without issue via dev console and standard web UI.
Thoughts anyone?