Testchooser

I want to make my app that is running close and run a other one I don't have any idea how to do this, I'm looking at testchooser class but I don't understand how it works and don't know if I can use the same way it loads the tests in my app. I just basically want to run a class and I don't want to search around for classes I also don't need a gui and actionlisteners… Just need to know how to close current running class and loading new class that will be specified to the program.