I'm not able to run an integration test in IntelliJ IDEA. Here is a test template generated by grails create-integration-test
@Integration
@Rollback
class TestServiceIntSpec extends Specification{
void "test something"() {
//some code here
}
}
Here is the output when I'm trying to run it from junit configuration :
Process finished with exit code 0
Empty test suite.
Also seems like grails using development env if I'm running this test from IDE, I have to specify env explicitly via -Dgrails.env=test
Spock tests ('Specification') identify which methods are tests by the presence of when:, then:, or expect:, etc.
HypeMK's answer is correct. To elaborate, the following test may not run because it does not have the presence of the spock keywords that outline the specification nature of the test (expect, when, then, etc):
@TestFor(BeanFormTagLib)
class BeanFormTagLibSpec extends Specification {
def setup() {}
void "address setup"() {
assertOutputEquals ('Hello World', '<g:beanFormTagLib domainName="com.myapp.Address" />');
}
}
Here we correct the issue by adding the "expect" keyword:
@TestFor(BeanFormTagLib)
class BeanFormTagLibSpec extends Specification {
def setup() {}
void "address setup"() {
expect:
assertOutputEquals ('Hello World', '<g:beanFormTagLib domainName="com.myapp.Address" />');
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With