@@ -6,6 +6,14 @@ Library XML
6
6
*** Test Cases ***
7
7
case1
8
8
Create Session api http://localhost:8000
9
+ ${addr} Get Request api users/1
10
+ Comment Should Be Equal As Strings ${addr.status_code} 200
11
+ log ${addr.content}
12
+ ${responsedata} to json ${addr.content}
13
+ ${body} Get Dictionary Keys ${responsedata}
14
+ ${body} Get Dictionary Items ${responsedata}
15
+ ${body} Get Dictionary Values ${responsedata}
16
+ ${str} Get From Dictionary ${responsedata} 1
9
17
${addr} Get Request api users/5
10
18
Comment Should Be Equal As Strings ${addr.status_code} 200
11
19
log ${addr.content}
@@ -17,11 +25,40 @@ case1
17
25
18
26
case2
19
27
Create Session api http://localhost:8000
20
- ${addr} Get Request api qitao
28
+ ${addr} Get Request api hello/ qitao
21
29
Comment Should Be Equal As Strings ${addr.status_code} 200
22
30
log ${addr.content}
23
- ${responsedata} to json ${addr.content}
31
+ log ${addr}
32
+ ${responsedata} To Json ${addr.content}
24
33
${body} Get Dictionary Keys ${responsedata}
25
34
${body} Get Dictionary Items ${responsedata}
26
35
${body} Get Dictionary Values ${responsedata}
27
36
${str} Get From Dictionary ${responsedata} hello
37
+ #xml方式
38
+ ${dict} Create Dictionary accept=application/xml
39
+ ${addr} get Request api hello/qitao ${dict}
40
+ Comment Should Be Equal As Strings ${addr.status_code} 200
41
+ log ${addr.content}
42
+ log ${addr}
43
+ ${responsedata} Set Variable ${addr.content}
44
+ ${body} Get Element Text ${responsedata} hello
45
+ ${hello} Get Element ${responsedata} hello
46
+ log ${hello.text}
47
+ ${responsedata} Add Element ${responsedata} <new id="3">test</new>
48
+ ${new} Get Element Attribute ${responsedata} id new
49
+ log ${new}
50
+ ${a} Element To String ${responsedata}
51
+
52
+ case3
53
+ #用户密码
54
+ ${auth} Create List ok python
55
+ Create Session api http://localhost:8000 \ \ ${auth}
56
+ ${addr} get Request api 401
57
+ Comment Should Be Equal As Strings ${addr.status_code} 200
58
+ log ${addr.content}
59
+ log ${addr}
60
+ ${responsedata} to json ${addr.content}
61
+ ${body} Get Dictionary Keys ${responsedata}
62
+ ${body} Get Dictionary Items ${responsedata}
63
+ ${body} Get Dictionary Values ${responsedata}
64
+ ${str} Get From Dictionary ${responsedata} pass
0 commit comments