0 votes
1 view
in Salesforce by (11.9k points)

I used the Apex Test Execution screen to run all the test cases in a sandbox org.

Several of the test cases passed and then progress appeared to hang on one test case which was previously working.

I then used the Abort button to try and cancel the test execution which appeared to work.

Now any subsequent attempts to run tests never progress past the Queued state.

ApexTestQueueItem stuck in Queued State

Selecting an individual apex class and using the synchronous Run Test button results in the following error message:

Organization Administration Locked

The changes you requested require salesforce.com to temporarily lock your organization's administration setup. However, the administration setup has already been locked by another change. Please wait for the previous action to finish, then try again later.

Trying to save changes to an Apex Class from Eclipse gives the error:

Save error: Unable to perform save on all files: The changes you requested require > salesforce.com to temporarily lock your organization's administration setup. However, the administration setup has already been locked by another change. Please wait for > the previous action to finish, then try again later. (ALREADY_IN_PROCESS)

If I query the ApexTestQueueItem table there appear to be 3 test cases stuck with the Processing status.

ApexTestQueueItem stuck in Processing

How can I clear out these ApexTestQueueItems from the Processing state? I'm assuming that this will get me past the Organization Administration lock.

I did check the Setup Audit Trail and the only recent changes were from my user to Apex Classes.

1 Answer

0 votes
by (31.6k points)

I've tried the following apex code to clear the apex test cases out of the processing queue:

List<ApexTestQueueItem> items = [Select Id,ApexClassId,Status,ExtendedStatus,ParentJobId from ApexTestQueueItem where Status != 'Completed'];

for(ApexTestQueueItem atqi : items) 

{

    atqi.Status = 'ABORTED';

}

update items;

From this, I don't seem to get the aspired result as on a subsequent SOQL query to ApexTestQueueItem the Status column remains unchanged.

I went looking for the Apex job under [Administration Setup > Monitoring > Apex Jobs] but none of the records where JobType=TestRequest appeared.

Next, I tried nullifying the job using anonymous apex:

System.abortJob('707L0000000FgZIIA0');

The AsyncApexJob changed Status to 'Aborted'.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...