File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44mkdir -p /var/data
55
6+ atest run -p test-suite-graphql.yaml
67atest run -p test-suite.yaml --report md --swagger-url " ${SERVER} /v3/api-docs" --level debug
78
89# cannot get the token in a pr
Original file line number Diff line number Diff line change 1+ # !api-testing
2+ # yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-schema.json
3+ name : SpringBoot
4+ api : |
5+ {{default "http://localhost:8080" (env "SERVER")}}
6+ spec :
7+ kind : GraphQL
8+ items :
9+ - name : queryBookById
10+ request :
11+ api : /graphql
12+ body :
13+ query : |
14+ query xxx($id: ID) {
15+ bookById(id: $id) {
16+ name
17+ }
18+ }
19+ operationName : xxx
20+ variables :
21+ id : book-1
22+ expect :
23+ bodyFieldsExpect :
24+ data.bookById.name : Effective Java
25+ - name : allBooks
26+ request :
27+ api : /graphql
28+ body :
29+ query : |
30+ query xxx {
31+ books {
32+ name
33+ }
34+ }
35+ expect :
36+ verify :
37+ - len(data.data.books) >= 3
38+ - name : queryBookById-not-found
39+ request :
40+ api : /graphql
41+ body :
42+ query : |
43+ query xxx {
44+ bookById(id: "book") {
45+ name
46+ }
47+ }
48+ expect :
49+ verify :
50+ - data.bookById == nil
51+ - name : addBook
52+ request :
53+ api : /graphql
54+ body :
55+ query : |
56+ mutation size {
57+ addBook(
58+ name: "name"
59+ pageCount: 1
60+ )
61+ }
Original file line number Diff line number Diff line change @@ -34,57 +34,3 @@ items:
3434 Authorization : " {{ .param.auth }}"
3535 expect :
3636 body : cookies are empty
37-
38- # # GraphQL
39- - name : queryBookById
40- request :
41- api : /graphql
42- method : POST
43- header :
44- Content-Type : application/json
45- body : |
46- {
47- "query": "query xxx($id: ID) {\n bookById(id: $id) {\n id\n name\n }\n}",
48- "operationName": "xxx",
49- "variables": {"id": "book-1"}
50- }
51- expect :
52- bodyFieldsExpect :
53- data.bookById.name : Effective Java
54- - name : allBooks
55- request :
56- api : /graphql
57- method : POST
58- header :
59- Content-Type : application/json
60- body : |
61- {
62- "query": "query xxx { books { name } }"
63- }
64- expect :
65- verify :
66- - len(data.data.books) >= 3
67- - name : queryBookById-not-found
68- request :
69- api : /graphql
70- method : POST
71- header :
72- Content-Type : application/json
73- body : |
74- {
75- "query": "query xxx {\n bookById(id: \"book\") {\n id\n name\n }\n}",
76- "operationName": "xxx"
77- }
78- expect :
79- verify :
80- - data.bookById == nil
81- - name : addBook
82- request :
83- api : /graphql
84- method : POST
85- header :
86- Content-Type : application/json
87- body : |
88- {
89- "query": "mutation size { addBook(name: \"name\"\n pageCount: 1)}"
90- }
You can’t perform that action at this time.
0 commit comments