How to run integration test for a specific class in grails 3.0

I am new to grails and trying to run existing integration tests for a specific class (using grails 3.0.11). (I do not want to run ALL test classes, only one)

  • Is it possible to do this for integration tests, or can only those Unit tests be executed?
  • If so, can anyone suggest how this can be done?

The testing class is as follows

@TestFor(ClassToBeTested)  
@Mock([])  
class ClassToBeTestedSpec extends Specification {  
...  
}  

I tried the following after viewing the posts here,

$ grails test-app -integration ClassToBeTested    

But I get below errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':integrationTest'.
> No tests found for given includes: [ClassToBeTested]

Thanks.

+4
source share
3 answers

For a test class in a package other than the standard:

grails test-app -integration *.ClassToBeTested

Or using gradle:

--tests *.ClassToBeTested

+2
source

"" , JUnit. , Spock "Spec" ?

JUnit , , "":

--tests *ClassToBeTestedTests

, Spock - ( Spock ):

--tests *.ClassToBeTestedSpec
+2

Grails 3 :

grails test-app com.yourpackage.yourapp.SomeWhateverSpec

, :

grails test-app *.SomeWhateverSpec

Spec , .

+1

Source: https://habr.com/ru/post/1624945/


All Articles