小编Sud*_*ppa的帖子

是否可以使用带有spock的spring rest docs

我在我的java应用程序中使用spock和groovy构建了测试用例.是否可以在不使用模拟mvc或restassured的情况下将spring rest docs添加到此项目中

这是我的项目剪辑

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'
    }
}
Run Code Online (Sandbox Code Playgroud)

java groovy spock spring-restdocs

2
推荐指数
1
解决办法
722
查看次数

标签 统计

groovy ×1

java ×1

spock ×1

spring-restdocs ×1