Search code examples
grailsgrails-plugin

grails 3 functional test plugin


When I use grails 2, I use the functional plugin to create the function test and I use Rest-client-builder to send post and get request. The function test itself can start up the server.

However, When I upgrade to grails 3. the built in geb framework can help me create the function test. However, I don't know how i can send the post and get request. And the function test itself can not start up the server. I have to run-app first and then run the test. Does anyone know what should I do function post/get test via grails 3?

Thanks very much


Solution

  • And the function test itself can not start up the server.

    You haven't described the details of what you are doing so I don't know why it might not be working for you, but it certainly can be made to work. You probably want to create integration tests and mark them with @Integration. We have a lot of examples in the project at https://github.com/grails/grails3-functional-tests. Look in https://github.com/grails/grails3-functional-tests/tree/master/app1/src/integration-test/groovy/functionaltests. A simple example that should be easy to read is at https://github.com/grails/grails3-functional-tests/blob/master/app1/src/integration-test/groovy/functionaltests/HomeSpec.groovy.

    I hope that helps.