Reputation: 391
I am new to grails, and am trying to run already existing integration tests for a particular class (using grails 3.0.11).(I don't want to run ALL the test classes, just a single one)
The test class looks like this
@TestFor(ClassToBeTested)
@Mock([])
class ClassToBeTestedSpec extends Specification {
...
}
I have tried the following after looking through posts here,
$ grails test-app -integration ClassToBeTested
But I get below error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':integrationTest'.
> No tests found for given includes: [ClassToBeTested]
Thanks.
Upvotes: 4
Views: 1211
Reputation: 7474
In Grails 3, you can run a specific test like this:
grails test-app com.yourpackage.yourapp.SomeWhateverSpec
or use star if you don't want to write the package hierarchy:
grails test-app *.SomeWhateverSpec
Don't forget to add the Spec word at the end, otherwise it won't work.
Upvotes: 1
Reputation: 264
I had to add 'Tests' to the end of the argument to make this work with JUnit. Perhaps Spock requires the text 'Spec' on the end too?
With JUnit, I needed to enter a pattern that matches the actual test class, including 'Tests':
--tests *ClassToBeTestedTests
I am guessing that using Spock, it might be something like (I don't have any Spock tests to verify this on):
--tests *.ClassToBeTestedSpec
Upvotes: 2
Reputation: 351
For a test class in a non-default package:
grails test-app -integration *.ClassToBeTested
Or with gradle:
--tests *.ClassToBeTested
Upvotes: 2