- Use a static analysis tool that kicks out a dependency diagram. That literally shows the dependency order.
- Look for import/include/using statements. That shows the dependency order.
- Look for inherits/implements part of class definitions. That shows the dependency order.
- Look at the build commands. It'll tell you the dependency order.
- When you see a function, constructor, whatever being used, you have a dependency.
And if the code is yours, and you don't know the dependency order, then fix that. Write it down or something.
Ideally, a test framework should enforce the order based on the project ontology. They don't usually do that though because they cannot easily examine the code being tested to extract the necessary dependency information.