I am working on a large project and need to offer users the ability to optionally enable or disable local integration test cases ( For pipeline, test cases must be enforced).
Asked
Active
Viewed 274 times
1
-
Could you tell us more about the project? (ex. pipeline, testcase library etc..) – minchaej Jun 29 '21 at 05:07
-
1There is a concept of [Profiles](https://www.baeldung.com/spring-profiles) in Spring. Also see https://stackoverflow.com/questions/44256956/run-gradle-task-with-spring-profiles-integration-tests – Михаил Нафталь Jun 29 '21 at 07:29
1 Answers
2
First of all, welcome to the community.
Next, you can modify the test
task inside the build.gradle
file or maybe add a new task called integrationTest
and implement your custom logic there.
As an instance, you can check this gist on Github: Separating tests from integration tests with Gradle
You can also use @Profile
annotation to your integration test classes and run your tests with different profiles. You can read more about profiles using the following link: Spring Profiles

Reza Ebrahimpour
- 814
- 6
- 20
-
-
You can also find some plugins equivalent to Maven `Surefire` and `Failsafe` plugins. But, the Github Gist that I shared in my answer works perfectly, at least for me. – Reza Ebrahimpour Jun 30 '21 at 07:18
-
The gist linked to above worked perfectly for me too and didn't require adding @Profile annotations to all my tests. – Justin Tilson Jan 21 '23 at 10:58
-
Where does the test function come from? I tried to import it but it didn't work. – emeraldhieu Aug 04 '23 at 11:35