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

Intellij Idea

Intellij Idea Problem Overview


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).

Intellij Idea Solutions


Solution 1 - Intellij Idea

  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.

Solution 2 - Intellij Idea

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

Solution 3 - Intellij Idea

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

Solution 4 - Intellij Idea

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)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMichael NealeView Question on Stackoverflow
Solution 1 - Intellij IdeacsauveView Answer on Stackoverflow
Solution 2 - Intellij IdeadigitalsanctumView Answer on Stackoverflow
Solution 3 - Intellij IdeaenreasView Answer on Stackoverflow
Solution 4 - Intellij IdeaVoyView Answer on Stackoverflow