I have test methods I want to use from test class A in test class B, in an async test run if test A runs before Test B I don't want to invoke the test A methods in test B because they already ran and it's redundant and vise versa, but I won't know the order the tests will run in each time.
Does anyone have any ideas on how to essentially implement logic that checks if a certain test class has ran before another test class in an async test run? Eventually I thought using ApexCodeCoverage could be a possibility and would be pretty cool, but it is only available via Tooling API and actual callouts in tests are not possible.
Theoretically I could create a single test class with the appropriate methods, but for organization purposes (because of the size of our environment) we are trying to keep a 1:1 class/test class ration.
Any ideas or input is appreciated!
Edit: the goal is to leverage existing test methods from an existing test class, but in an async test run ensure those methods are only invoked a single time otherwise it's redundant and contradicts another initiative we have of lowering test run time. The order does not actually matter and at the end of the test run both classes should be covered, meaning Test B can run before Test A and vise versa, but in Test B (the new test class invoking existing methods in an existing test class) I would like to programmatically evaluate whether or not those methods need to be invoked or not (because Test A and the shared methods may or may not have ran before Test B).
This is probably a niche question based on practices we are trying to adopt to help maintain our very large environment. I think I may end up just checking whether or not the test is running in our production environment, and if so I will not invoke the shared methods in the new test class because at some point in the test run they will be called, but if someone needs to modify the class of which the new test class is covering, they would be working in a sandbox and we only care about redundancy and test runtime during our production test runs therefore even if they need to run a test suite including the class with the shared methods the additional minute of runtime does not really matter (apologies if I did a poor job of explaining my goal)