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

7

44

I have a Spring MVC project using IntelliJ IDEA 14 as my IDE (I'm new to IntelliJ IDEA; I used Eclipse).

My main Java code is in folder src/main, and the unit test code is in src/test. While deploying the project, I found that all the unit tests are executed.

How can I skip all the unit tests while deploying the project into Tomcat?

Saratov answered 14/8, 2015 at 9:8 Comment(4)
are you using maven?Yenyenisei
yes, i'm using maven. @albertSaratov
could that help? maven.apache.org/surefire/maven-surefire-plugin/examples/…Yenyenisei
what i have guessed too, but then its not a specific intellij question. maven.apache.org/general.html#skip-testNovelistic
J
130

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

Jackhammer answered 14/8, 2015 at 9:18 Comment(4)
Does an option exist to do this on a per project basis? If you click Skip Tests Mode, test runs are disabled for all maven projects.Gyrostabilizer
This didn't work me (or at least the way I want it to). Even after disabling tests like this, when I run a Run or Debug configuration, the build attempts to compile the tests. Can we skip compile as well? Because in the codebase I'm working there are hell lot of tests with compile errors.Position
How to skip even building the tests/test packages?Cocker
Still works in IntelliJ IDEA 2023.3.2 (Community Edition), the icon has changed though.Allanite
S
13

When creating a maven configuration for the project. On the Runner tab you can click on skip test checkbox as below :

enter image description here

It helped me a lot!

Silicify answered 21/11, 2018 at 13:29 Comment(0)
V
2

Even I faced this same issue as I have newly started using IntelliJ starting today. So I have trouble to find that logo in the screenshot shared in the post shared by dimitrisli and also accepted answer. Let me share my solution to this issue with latest IntelliJ version.

Open IntelliJ IDE, press Ctrl + Alt + S, this will open settings window, now look at the screenshot I shared and do the same settings and you are done. Make sure you click the check box for Skip Tests.

My IntelliJ IDE version:
IntelliJ IDEA 2022.2.4 (Community Edition)

enter image description here

Vigen answered 24/11, 2022 at 11:11 Comment(0)
B
2

Toggle 'Skip Tests' Mode.

This button will help you

Baronetcy answered 21/10, 2023 at 11:26 Comment(0)
M
1

In the Tomcat Run/Debug configurations you can specify in the Before launch section a maven task with this parameter:

-Dmaven.test.skip=true

Maffa answered 10/4, 2021 at 21:26 Comment(0)
S
1

Edit Run configuration > Java Options and Modify > Select "Skip tests" and Save

Maven Run/Debug Configuration

Sweatbox answered 18/2, 2023 at 22:27 Comment(0)
P
0

mvn -DskipTests=true clean install (or other command)

Pegues answered 9/8, 2022 at 8:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.