Skip to content

Instantly share code, notes, and snippets.

@cemerson
Last active September 30, 2020 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cemerson/8aad683ee55fce47854c8620a301d812 to your computer and use it in GitHub Desktop.
Save cemerson/8aad683ee55fce47854c8620a301d812 to your computer and use it in GitHub Desktop.
SFDC: Clear running or stuck Apex Tests
/* Use if/when you have tests that are stuck in the middle or running
(sometimes this can happen and you can't actually see/confirm it -
in which case running this will clear everything out) */
List<ApexTestQueueItem> atqi_list = [select id, status from apextestqueueitem where status NOT IN ('Completed', 'Failed', 'Aborted')];
for(ApexTestQueueItem atqi : atqi_list)
atqi.status = 'Aborted';
update atqi_list;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment