Credit: This answer is inspired by JB Nizet’s answer. It is posted because it is more direct to my question.
To run the unit tests only, create a new task like this:
task unitTest( type: Test ) {
exclude '**/cucumber/**'
}
This way we have:
run all tests: ./gradlew test
run all unit tests: ./gradlew unitTest
run all functional tests: ./gradlew test -Dtest.single=cucumber/**/
Related Contents:
- Cannot run gradle test tasks because of java.lang.NoClassDefFoundError: jdk/internal/reflect/GeneratedSerializationConstructorAccessor1
- How to enable debug on my JUnit through Gradle test task
- How do I test a class that has private methods, fields or inner classes?
- Can Mockito capture arguments of a method called multiple times?
- Error: Unfortunately you can’t have non-Gradle Java modules and > Android-Gradle modules in one project
- Mockito verify order / sequence of method calls
- Java: How to test methods that call System.exit()?
- Creating runnable JAR with Gradle
- Java verify void method calls n times with Mockito
- Getting Gradle dependencies in IntelliJ IDEA using Gradle build
- Gradle task – pass arguments to Java application
- How to give System property to my test via Gradle and -D
- “aapt” IOException error=2, No such file or directory” why can’t I build my gradle on jenkins?
- Separation of JUnit classes into special test package?
- How to import android project as library and NOT compile it as apk (Android studio 1.0)
- Run single test from a JUnit class using command-line
- mockito callbacks and getting argument values
- JUnit test with dynamic number of tests
- AssertEquals 2 Lists ignore order
- How do I resolve “Duplicate files copied in APK META-INF/*”
- Problems passing system properties and parameters when running Java class via Gradle
- Difference between google() and maven { url ‘https://maven.google.com’ }
- How to write junit tests for interfaces?
- How to simulate a DB for testing (Java)?
- Mockito, JUnit and Spring
- Final method mocking
- Should the JUnit message state the condition of success or failure?
- EasyMock: Void Methods
- Building with Intellij 2017.2 /out directory duplicates files in /build directory
- Try catch in a JUnit test
- Mockito cannot mock this class
- How to disable entire unit test in TestNG?
- mocking a singleton class
- Mock static java methods using Mockk
- mock methods in same class
- Mocking Static Blocks in Java
- Mark unit test as an expected failure in JUnit
- Adding local plugin to a Gradle project
- Testing against Java EE 6 API
- Error:Execution failed for task ‘:app:packageRelease’. > Unable to compute hash of /../AndroidStudioProjects/../classes.jar
- “The filename or extension is too long error” using gradle
- What does Gradle ‘build’ task include exactly
- How to suppress specific Kotlinc/Javac compiler warnings?
- Is there a Java unit-test framework that auto-tests getters and setters? [closed]
- Building an uberjar with Gradle
- Configure Gradle to publish sources and javadoc
- How to disable Gradle daemon in IntelliJ Idea?
- Mockito.any() for
- Building a JavaFX application using Gradle
- IntelliJ: (Coverage): Error during class instrumentation: … java.lang.ArrayIndexOutOfBoundsException