2
我有我的Java應用程序中使用spock和groovy構建測試用例。是否有可能彈簧安置文檔添加到項目,而無需使用模擬MVC或restassured是否有可能使用spock的spring rest文檔
這裏是我的項目的文檔片斷
import groovyx.net.http.RESTClient;
import spock.lang.Specification;
class FindIdeasSpec extends Specification{
def host ="http://www.localhost.com:8080/v1/"
def path = "communities/"
def client = new RESTClient(host)
def id = 1
def "verify the links"() {
when: "request ideas list"
def response = client.get(path: path + id + '/ideas')
then: "returns parent and self link"
with(response) {
status == 200
data.links.rel == ['self']
data.links.href[0] == host + path + id + '/ideas'
}
}