My Spock Test in Grails errors out saying "No tests found". I'm following the a guide here: http://guides.grails.org/creating-your-first-grails-app/guide/index.html 9 Testing your App
ValueEstimateServiceSpec.groovy is located at: grails-apps\myApp\src\test\groovy\org\grails\myapp
What am I doing wrong? Thanks!
$ ./grailsw test-app org.grails.myapp.ValueEstimateServiceSpec
:compileJava NO-SOURCE
:compileGroovy UP-TO-DATE
:buildProperties
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava NO-SOURCE
:compileTestGroovy
:processTestResources NO-SOURCE
:testClasses
:test
:compileIntegrationTestJava NO-SOURCE
:compileIntegrationTestGroovy
:processIntegrationTestResources UP-TO-DATE
:integrationTestClasses
:integrationTest FAILED
:mergeTestReports
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':integrationTest'.
> No tests found for given includes: [org.grails.myapp.ValueEstimateServiceSpec]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.77 secs
Tests FAILED |
Test execution failed
Here is my code for the test class
package org.grails.myapp
import grails.testing.gorm.DataTest
import grails.testing.services.ServiceUnitTest
import spock.lang.Specification
class ValueEstimateServiceSpec extends Specification implements ServiceUnitTest<ValueEstimateService>, DataTest {
void setupSpec() {
mockDomain Make
mockDomain Model
mockDomain Vehicle
}
void testEstimateRetrieval() {
given: 'a vehicle'
def make = new Make(name: 'Test')
def model = new Model(name: 'Test', make: make)
def vehicle = new Vehicle(year: 2000, make: make, model: model, name: 'Test vehicle')
when: 'service is called'
def estimate = service.getEstimate(vehicle)
then: 'a non-zero result is returned'
estimate > 0
and: 'estimate is not too large'
estimate < 1000000
}
}
Aucun commentaire:
Enregistrer un commentaire