Selecting Testcases to run from a list of all tests
Answered
Hi!
Is there a way to get a list of all Test within the opened Project to select the tests I want to execute?
In Visual Studio I can get a View with all Test Cases structured like the folder/package hierarchy.
There I can select with check boxes which test cases I would like to run.
Is there something similar in IDEA?
I only know how to run all Test Cases from a package or a Class (In the Project Explorer) or how to run one specific Test (directly from the code),
But I don't know how to run e.g. one test from ClassA and two from ClassC.
Is there a way?
Please sign in to leave a comment.
You can only run multiple selected classes by adding the class names in the dialog:
There is no way to choose individual test methods from different classes.
We don't have all tests enumerated. You can browse only all files in Test Scope in project view.
Anna
Can I use a RE to selected the files? For instance, *_UT.* to run all my UTs? If I have to pick the individual files each time then I have to remember to add new UT files to the list each time.
Yes, please see https://stackoverflow.com/a/43182331/104891 for the sample configuration.
It then should only execute the few selected tests.
BTW You can select tests from class structure (Ctrl F12) as well; won't work well for parameterized tests though
Simon Gwerder's solution worked very well for me in IJ 2021.1
Better yet, be able to supply a list of tests to run. This is a common scenario. I'm working on a project with +800 tests. When 10 fail in CI/CD cloud solution, I'd like to be able to work through the list of failed tests locally before I commit to another CI/CD run.