/
GET-Positive.robot
117 lines (104 loc) · 6.44 KB
/
GET-Positive.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
*** Settings ***
Resource TAF/testCaseModules/keywords/common/commonKeywords.robot
Resource TAF/testCaseModules/keywords/core-metadata/coreMetadataAPI.robot
Suite Setup Run Keywords Setup Suite
... AND Run Keyword if $SECURITY_SERVICE_NEEDED == 'true' Get Token
Suite Teardown Run Teardown Keywords
Force Tags v2-api
*** Variables ***
${SUITE} Core Metadata Device Profile GET Positive Test Cases
${LOG_FILE_PATH} ${WORK_DIR}/TAF/testArtifacts/logs/core-metadata-deviceprofile-get-positive.log
*** Test Cases ***
ProfileGET001 - Query all device profiles
[Tags] SmokeTest
Given Generate Multiple Device Profiles Sample
And Create Device Profile ${deviceProfile}
When Query All Device Profiles
Then Should Return Status Code "200" And profiles
And totalCount Is Greater Than Zero And ${content}[profiles] Count Should Match totalCount
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Device Profiles By Names Test-Profile-1 Test-Profile-2 Test-Profile-3
ProfileGET002 - Query all device profiles by offset
Given Generate Multiple Device Profiles Sample
And Create Device Profile ${deviceProfile}
And Set Test Variable ${offset} 2
When Query All Device Profiles With offset=${offset}
Then Should Return Status Code "200" And profiles
And totalCount Is Greater Than Zero And ${content}[profiles] Count Should Match totalCount-offset
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Device Profiles By Names Test-Profile-1 Test-Profile-2 Test-Profile-3
ProfileGET003 - Query all device profiles by limit
Given Generate Multiple Device Profiles Sample
And Create Device Profile ${deviceProfile}
And Set Test Variable ${limit} 2
When Query All Device Profiles With limit=${limit}
Then Should Return Status Code "200" And profiles
And totalCount Is Greater Than Zero And ${content}[profiles] Count Should Match limit
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Device Profiles By Names Test-Profile-1 Test-Profile-2 Test-Profile-3
ProfileGET004 - Query all device profiles by labels
Given Generate Multiple Device Profiles Sample
And Create Device Profile ${deviceProfile}
When Query All Device Profiles With labels=bacnet
Then Should Return Status Code "200" And profiles
And totalCount Is Greater Than Zero And ${content}[profiles] Count Should Match totalCount
And Profiles Should Be Linked To Specified Labels: bacnet
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Device Profiles By Names Test-Profile-1 Test-Profile-2 Test-Profile-3
ProfileGET005 - Query device profile by name
Given Generate A Device Profile Sample Test-Profile-1
And Create Device Profile ${deviceProfile}
When Query Device Profile By Name Test-Profile-1
Then Should Return Status Code "200" And profile
And Should Be True "${content}[profile][name]" == "Test-Profile-1"
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Device Profile By Name Test-Profile-1
ProfileGET006 - Query device profiles by manufacturer
# Multiple device profile which part of same manufacturer
Given Create Multiple Device Profiles Sample With Different Manufacturers
When Query All Device Profiles By Manufacturer Honeywell
Then Should Return Status Code "200" And profiles
And totalCount Is Greater Than Zero And ${content}[profiles] Count Should Match totalCount
And Profiles Should Be Linked To Specified Manufacturer: Honeywell
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Device Profiles By Names Test-Profile-1 Test-Profile-2 Test-Profile-3
ProfileGET007 - Query device profiles by manufacturer and offset
# Multiple device profile which part of same manufacturer
Given Create Multiple Device Profiles Sample With Different Manufacturers
And Set Test Variable ${offset} 1
When Query All Device Profiles By Manufacturer Honeywell With offset=${offset}
Then Should Return Status Code "200" And profiles
And totalCount Is Greater Than Zero And ${content}[profiles] Count Should Match totalCount-offset
And Profiles Should Be Linked To Specified Manufacturer: Honeywell
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Device Profiles By Names Test-Profile-1 Test-Profile-2 Test-Profile-3
ProfileGET008 - Query device profiles by manufacturer and limit
# Multiple device profile which part of same manufacturer
Given Create Multiple Device Profiles Sample With Different Manufacturers
And Set Test Variable ${limit} 2
When Query All Device Profiles By Manufacturer Honeywell With limit=${limit}
Then Should Return Status Code "200" And profiles
And totalCount Is Greater Than Zero And ${content}[profiles] Count Should Match limit
And Profiles Should Be Linked To Specified Manufacturer: Honeywell
And Should Return Content-Type "application/json"
And Response Time Should Be Less Than "${default_response_time_threshold}"ms
[Teardown] Delete Multiple Device Profiles By Names Test-Profile-1 Test-Profile-2 Test-Profile-3
*** Keywords ***
Profiles Should Be Linked To Specified ${property}: ${value}
${profiles}= Set Variable ${content}[profiles]
${property}= Convert To Lower Case ${property}
FOR ${item} IN @{profiles}
Run keyword if "${property}" == "labels" List Should Contain Value ${item}[${property}] ${value}
... ELSE IF "${property}" == "manufacturer" Should Be Equal As Strings ${item}[${property}] ${value}
END
Create Multiple Device Profiles Sample With Different Manufacturers
Generate Multiple Device Profiles Sample
Set To Dictionary ${deviceProfile}[0][profile] manufacturer=Not_Honeywell
Create Device Profile ${deviceProfile}