kadishmal
(Esen Sagynov)
July 20, 2012, 10:58am
1
I am running hibernate test now and need to test specific tests only instead of waiting for several hour to see the full results. I run the following command:
gradlew clean :hibernate-core:matrix_cubrid -Dtest.single=:hibernate-core:test:org/hibernate/test/annotations/EntityTest
Here gradlew is a hibernate wrapper for gradle.
But I can’t get it work. The command still runs the entire suite instead of a single one that I’ve defined.
How can I run a single test suite?
Thanks.
Sounds like the ‘Test’ task that executes ‘EntityTest’ isn’t named ‘test’. For example, if the task is named ‘integrationTest’, you’ll have to use ‘-DintegrationTest.single=…’.
kadishmal
(Esen Sagynov)
July 20, 2012, 11:15am
3
I just tried this:
gradlew clean -Dhibernate-core:matrix_cubrid.single=EntityTest :hibernate-core:matrix_cubrid
Still doesn’t work. Still executes all tests.
If at all, the task name is ‘matrix_cubrid’. I can’t tell if this is a ‘Test’ task though.
kadishmal
(Esen Sagynov)
July 20, 2012, 11:53am
5
I can’t make it work at all. Tried everything:
gradlew clean -Dmatrix_cubrid.single=EntityTest matrix_cubrid
gradlew -Dmatrix_cubrid.single=org/hibernate/test/annotations/EntityTest matrix_cubrid
gradlew -Dmatrix_cubrid.single=:hibernate-core:test:org/hibernate/test/annotations/EntityTest matrix_cubrid
gradlew -Dmatrix_cubrid.single=:hibernate-core:org/hibernate/test/annotations/EntityTest matrix_cubrid
gradlew -Dmatrix_cubrid.single=:hibernate-core:test:EntityTest matrix_cubrid
Nothing works. All either execute all test all say “Could not find matching test for pattern”.
What else can I try?
kadishmal
(Esen Sagynov)
July 20, 2012, 12:31pm
6
Finally found:
./gradlew clean -Dmatrix_cubrid.single=annotations/EntityTest :hibernate-core:matrix_cubrid
The first line should work as long as you run just the ‘matrix_cubrid’ task that contains the test (I assume there might be multiple such tasks). The other lines have incorrect test name patterns. As usual, the Gradle User Guide has the details.
By the way, ‘gradlew’ is the Gradle Wrapper .
kadishmal
(Esen Sagynov)
July 20, 2012, 12:34pm
8
Yes, I understood that from the docs.
Jeremy1
(gradlegoodness)
August 10, 2012, 1:06pm
9
Hi,
I have been struggling getting this working in the hibernate project. The test case I created in the hibernate-core subproject is this object.
org.hibernate.test.annotations.derivedidentities.e1.b.specjmapid.lazy.CompositeKeyDeleteTest
The successful execution of this single test works using
$ gradlew -Dtest.single=CompositeKeyDeleteTest :hibernate-core:test
If the test class structure is as follows: test-service/src/test/java/sample/tools/source/TestServiceSample.java
can this single test be executed as : gradlew -Dtest.single=annotations/TestServiceSample :test-service:test
The gradle task is defined as “test” only.