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?

2
8 comments

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.

0

We don't have all tests enumerated. You can browse only all files in Test Scope in project view.

Anna

0
Avatar
Permanently deleted user

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.

0
  • Start the whole test class first.
  • Wait until you see the list of tests. You can abort the execution.
  • Select the tests you want to execute
  • Right click > Run ...

It then should only execute the few selected tests.

1

BTW You can select tests from class structure (Ctrl F12) as well; won't work well for parameterized tests though

0

Simon Gwerder's solution worked very well for me in IJ 2021.1

0

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.

0

Please sign in to leave a comment.