Excluding Tests from Being Run in Intellij

Disable tests compilation in Intellij

Yes there is.

Got to Settings -> Build,Ex.. -> Compiler -> Excludes and press the + button:
Sample Image

select the path you want to exclude. In your case it's the test folder:
Sample Image

Check the recursive checkbox on the right side and you should see that your test folder has no a little x on the folder to mark it as excluded:

BTW: Remeber these little x, because Intellij IDEA provides an intention to exclude certain package from compilation.
Executing that intention by accident could lead to a long journey of searching and asking in order to understand why certain packages aren't build anymore.

Sample Image

IntelliJ IDEA 14: How to skip tests while deploying project into Tomcat

In case you are using Maven, on the View > Tool Windows > Maven Projects click on the button shown below ( called Skip Tests Mode). Essentially it is taking the test phase out of the lifecycle when you say run package.

enter image description here

Run all tests except for a JUnit Category in IntelliJ

Some time has passed since I asked this question, and in that time the Gradle test runner has become the default (at least for me). So though the built-in runner may not have this functionality, you can easily create a gradle task that excludes categories or tags:

test {
useJUnitPlatform {
excludeTags 'integrationTest'
excludeTags 'endToEndTest'
excludeTags 'testDriver'
}
options {
exclude '**/*Integration*'
exclude 'integrationTest'
exclude 'endToEndTest'
exclude 'testDriver'
}

}

enter image description here

Intellij : Find usages , but exclude test files from results

Intellij Ultimate 11 version has an option to search in "Project production files".

Just press Alt+F7 on a usage and look on Scope.



Related Topics



Leave a reply



Submit