I'm making a service that watches a certain directory and when it detects changes in code in that directory, it runs all the tests in the directory. Purpose is that it runs the tests on the changes in code in that directory. So if I add a new method in a class and then a new test, it should use the new class and new test and include it in its testrun.
How can I do this dynamically? I can dynamically load all the test classes, by scanning the directory and collecting the tests and using my own custom dynamic loader ( as done by Reload used classes at runtime Java ). But the classes remain the ones before the changes. Before the service started watching, i.e before runtime.
How can I force those classes used in the tests to also be dynamically loaded?