Michael Neale
Michael Neale

Reputation: 19468

How do I make IntelliJ IDEA run all the tests in a package including sub packages

If I click on a package and do control-shift-F10 it only looks for and runs JUnit tests in that package - but I really want it to recurse down into subpackages and run them.

UPDATE: looks like its something else wrong. When I run it on a package that has tests, it still complains there are none (yet if I open a JUnit test I can run it just fine).

Upvotes: 92

Views: 65372

Answers (4)

Voy
Voy

Reputation: 6284

For Python users:

  1. Include __init__.py in each subfolder
  2. Create a dummy_test.py in the root of your tests directory, eg.:
class DummyTest(TestCase): 
    pass

(credit to this answer)

Upvotes: -3

enreas
enreas

Reputation: 11262

I've solved this thanks to csauve response. This could be an answer to his, but I didn't know how to include an image there.

Run/Debug Configurations dialog box can be access via Run > Edit Configurations. Use these options to create one that runs all your tests:

Run/Debug configuration for all tests

Upvotes: 5

csauve
csauve

Reputation: 6263

  1. Run->Edit Configurations...
  2. Create a new junit test configuration
  3. Name it "All tests"
  4. Include entire package
  5. Apply/Run.

enter image description here

From @andersoyvind's comment.

Upvotes: 198

digitalsanctum
digitalsanctum

Reputation: 3299

The default key combination to run all tests is Ctrl+Shift+F10

Upvotes: 13

Related Questions