Run Apex Test in Org Credential not executing consistently

When running Apex Test in org credentials, you may notice that some of the Apex Test Results are showing incorrect results. This could be 0% in Successes and 0ms in the Total time.

If you open one of the Apex Test Result records in the Org Credential and download the attachment with name "ApexTestResult", the message below will be displayed in the classes:

'Dependent class is invalid and needs recompilation'

The Salesforce article below explains the reason why this error appears and how to resolve it.

https://help.salesforce.com/articleView?id=000340653&type=1&mode=1


How did we do?