Testing
Version 33 (Adrian Georgescu, 06/09/2011 10:00 am)
| 1 | 20 | Adrian Georgescu | = Testing = |
|---|---|---|---|
| 2 | 1 | Redmine Admin | |
| 3 | 23 | Adrian Georgescu | [[TOC(Installation,Configuration,Testing, depth=2)]] |
| 4 | 22 | Adrian Georgescu | |
| 5 | 20 | Adrian Georgescu | == Test Suite == |
| 6 | 20 | Adrian Georgescu | |
| 7 | 33 | Adrian Georgescu | A test suite for testing the functionality the server is located in /test directory. |
| 8 | 1 | Redmine Admin | |
| 9 | 27 | Adrian Georgescu | If the software has been installed as a Debian package, you can locate the files using: |
| 10 | 26 | Adrian Georgescu | |
| 11 | 26 | Adrian Georgescu | {{{ |
| 12 | 27 | Adrian Georgescu | dpkg -L openxcap |
| 13 | 26 | Adrian Georgescu | }}} |
| 14 | 1 | Redmine Admin | |
| 15 | 26 | Adrian Georgescu | Configure the credentials of a test account and the xcap root in a configuration file as follows: |
| 16 | 26 | Adrian Georgescu | |
| 17 | 1 | Redmine Admin | {{{ |
| 18 | 1 | Redmine Admin | ~/.xcapclient.ini |
| 19 | 9 | Adrian Georgescu | }}} |
| 20 | 9 | Adrian Georgescu | |
| 21 | 9 | Adrian Georgescu | {{{ |
| 22 | 9 | Adrian Georgescu | [Account_test] |
| 23 | 1 | Redmine Admin | sip_address=alice@example.com |
| 24 | 27 | Adrian Georgescu | password=1234 |
| 25 | 25 | Adrian Georgescu | xcap_root = http://xcap.example.com/xcap-root |
| 26 | 1 | Redmine Admin | }}} |
| 27 | 1 | Redmine Admin | |
| 28 | 18 | Adrian Georgescu | Replace the xcap_root with the same xcap_root configured in the server and make sure the hostname points to the IP address where the server listens to. |
| 29 | 19 | Adrian Georgescu | |
| 30 | 18 | Adrian Georgescu | Add the same test account to the OpenSIPS subscriber table: |
| 31 | 16 | Adrian Georgescu | |
| 32 | 16 | Adrian Georgescu | {{{ |
| 33 | 28 | Adrian Georgescu | INSERT INTO `subscriber` (username,domain,password,ha1) |
| 34 | 21 | Adrian Georgescu | VALUES |
| 35 | 28 | Adrian Georgescu | ('alice','example.com','1234','fd7cab2287702c763e7b318b7fb2451a'); |
| 36 | 16 | Adrian Georgescu | }}} |
| 37 | 16 | Adrian Georgescu | |
| 38 | 1 | Redmine Admin | Then run the test suite: |
| 39 | 1 | Redmine Admin | |
| 40 | 1 | Redmine Admin | {{{ |
| 41 | 33 | Adrian Georgescu | ~/openxcap/test$./test.py |
| 42 | 32 | Redmine Admin | test_delete (test_element.ElementTest) ... ok |
| 43 | 32 | Redmine Admin | test_get (test_element.ElementTest) ... WARNING: test with URI in att_value is disabled |
| 44 | 1 | Redmine Admin | ok |
| 45 | 32 | Redmine Admin | test_put_error (test_element.ElementTest) ... ok |
| 46 | 32 | Redmine Admin | test400_1 (test_errors.ErrorsTest) ... ok |
| 47 | 32 | Redmine Admin | test400_2 (test_errors.ErrorsTest) ... ok |
| 48 | 32 | Redmine Admin | test404 (test_errors.ErrorsTest) ... ok |
| 49 | 32 | Redmine Admin | test405 (test_errors.ErrorsTest) ... ok |
| 50 | 32 | Redmine Admin | test409 (test_errors.ErrorsTest) ... ok |
| 51 | 32 | Redmine Admin | test_gibberish (test_errors.ErrorsTest) ... ok |
| 52 | 1 | Redmine Admin | test_global_auth (test_auth.AuthTest_org_openmobilealliance_pres_rules) ... ok |
| 53 | 1 | Redmine Admin | test_users_auth (test_auth.AuthTest_org_openmobilealliance_pres_rules) ... ok |
| 54 | 1 | Redmine Admin | test_global_auth (test_auth.AuthTest_pidf_manipulation) ... ok |
| 55 | 1 | Redmine Admin | test_users_auth (test_auth.AuthTest_pidf_manipulation) ... ok |
| 56 | 1 | Redmine Admin | test_global_auth (test_auth.AuthTest_pres_rules) ... ok |
| 57 | 1 | Redmine Admin | test_users_auth (test_auth.AuthTest_pres_rules) ... ok |
| 58 | 1 | Redmine Admin | test_global_auth (test_auth.AuthTest_resource_lists) ... ok |
| 59 | 10 | Adrian Georgescu | test_users_auth (test_auth.AuthTest_resource_lists) ... ok |
| 60 | 1 | Redmine Admin | test_global_auth (test_auth.AuthTest_rls_services) ... ok |
| 61 | 1 | Redmine Admin | test_users_auth (test_auth.AuthTest_rls_services) ... ok |
| 62 | 1 | Redmine Admin | test_global_auth (test_auth.AuthTest_test_app) ... ok |
| 63 | 1 | Redmine Admin | test_users_auth (test_auth.AuthTest_test_app) ... ok |
| 64 | 1 | Redmine Admin | test_global_auth (test_auth.AuthTest_watchers) ... ok |
| 65 | 10 | Adrian Georgescu | test_users_auth (test_auth.AuthTest_watchers) ... ok |
| 66 | 1 | Redmine Admin | test_global_auth (test_auth.AuthTest_xcap_caps) ... ok |
| 67 | 1 | Redmine Admin | test_users_auth (test_auth.AuthTest_xcap_caps) ... ok |
| 68 | 32 | Redmine Admin | test_conditional_PUT (test_etags2.ETagTest) ... ok |
| 69 | 32 | Redmine Admin | test_conditional_PUT_2 (test_etags2.ETagTest) ... ok |
| 70 | 32 | Redmine Admin | test_xpath10_valid (test_xpath.XPathTest) ... ok |
| 71 | 32 | Redmine Admin | test_xpath11_valid (test_xpath.XPathTest) ... ok |
| 72 | 32 | Redmine Admin | test_xpath12_valid (test_xpath.XPathTest) ... ok |
| 73 | 32 | Redmine Admin | test_xpath1_valid (test_xpath.XPathTest) ... ok |
| 74 | 32 | Redmine Admin | test_xpath2_invalid (test_xpath.XPathTest) ... ok |
| 75 | 32 | Redmine Admin | test_xpath3_invalid (test_xpath.XPathTest) ... ok |
| 76 | 32 | Redmine Admin | test_xpath4_invalid (test_xpath.XPathTest) ... ok |
| 77 | 32 | Redmine Admin | test_xpath5_invalid (test_xpath.XPathTest) ... ok |
| 78 | 32 | Redmine Admin | test_xpath6_invalid (test_xpath.XPathTest) ... ok |
| 79 | 32 | Redmine Admin | test_xpath7_invalid (test_xpath.XPathTest) ... ok |
| 80 | 32 | Redmine Admin | test_xpath8_invalid (test_xpath.XPathTest) ... ok |
| 81 | 32 | Redmine Admin | test_xpath9_valid (test_xpath.XPathTest) ... ok |
| 82 | 1 | Redmine Admin | test_pidf_manipulation (test_presrules.PresenceRulesTest) ... ok |
| 83 | 1 | Redmine Admin | test_operations1 (test_resourcelists.DocumentTest) ... ok |
| 84 | 1 | Redmine Admin | test_operations2 (test_resourcelists.DocumentTest) ... ok |
| 85 | 1 | Redmine Admin | test_operations3 (test_resourcelists.DocumentTest) ... ok |
| 86 | 1 | Redmine Admin | test_operations4 (test_resourcelists.DocumentTest) ... ok |
| 87 | 32 | Redmine Admin | test_ns_bindings (test_nsbindings.NSBindingsTest) ... ok |
| 88 | 32 | Redmine Admin | test_has_global (test_global.TestGlobal) ... ok |
| 89 | 32 | Redmine Admin | test_no_global (test_global.TestGlobal) ... ok |
| 90 | 32 | Redmine Admin | test_errors (test_fragment.FragmentTest) ... ok |
| 91 | 32 | Redmine Admin | test_success (test_fragment.FragmentTest) ... ok |
| 92 | 1 | Redmine Admin | test_operations1 (test_rlsservices.DocumentTest) ... ok |
| 93 | 10 | Adrian Georgescu | test_operations2 (test_rlsservices.DocumentTest) ... ok |
| 94 | 1 | Redmine Admin | test_operations3 (test_rlsservices.DocumentTest) ... ok |
| 95 | 1 | Redmine Admin | test_operations4 (test_rlsservices.DocumentTest) ... ok |
| 96 | 32 | Redmine Admin | test_pidf_manipulation (test_pidf.PIDFTest) ... ok |
| 97 | 32 | Redmine Admin | test_conditional_GET (test_etags.ETagTest) ... ok |
| 98 | 32 | Redmine Admin | test_conditional_PUT (test_etags.ETagTest) ... ok |
| 99 | 32 | Redmine Admin | test_conditional_PUT_2 (test_etags.ETagTest) ... ok |
| 100 | 32 | Redmine Admin | test_conditional_GET (test_etags.ETagTest2) ... ok |
| 101 | 32 | Redmine Admin | test_conditional_PUT (test_etags.ETagTest2) ... ok |
| 102 | 32 | Redmine Admin | test_etag_parsing (test_etags.ETagTest2) ... ok |
| 103 | 32 | Redmine Admin | Testing different ways of inserting an element as described in examples from Section 8.2.3 ... ok |
| 104 | 32 | Redmine Admin | Testing PUT requests of form '*[@att="some"]' which require looking into body of PUT ... ok |
| 105 | 32 | Redmine Admin | test_replacement (test_element_put.PutElementTest) ... ok |
| 106 | 10 | Adrian Georgescu | test_schema (test_xcap_caps.XCAPCaps) ... ok |
| 107 | 32 | Redmine Admin | test_delete (test_attribute.AttributeTest) ... ok |
| 108 | 32 | Redmine Admin | test_get (test_attribute.AttributeTest) ... WARNING: test with URI in att_value is disabled |
| 109 | 32 | Redmine Admin | ok |
| 110 | 32 | Redmine Admin | test_put (test_attribute.AttributeTest) ... ok |
| 111 | 32 | Redmine Admin | test_get (test_watchers.Test) ... ok |
| 112 | 1 | Redmine Admin | |
| 113 | 10 | Adrian Georgescu | ---------------------------------------------------------------------- |
| 114 | 32 | Redmine Admin | Ran 68 tests in 38.662s |
| 115 | 10 | Adrian Georgescu | |
| 116 | 10 | Adrian Georgescu | OK |
| 117 | 10 | Adrian Georgescu | }}} |
| 118 | 1 | Redmine Admin | |
| 119 | 1 | Redmine Admin | === Notes === |
| 120 | 1 | Redmine Admin | |
| 121 | 1 | Redmine Admin | * Running the test suite for a given user will result in the destruction of all xcap documents belonging to that user |
| 122 | 1 | Redmine Admin | * Replacing 'test.py' with 'test_something.py' will run only the tests defined in test_something.py |
| 123 | 32 | Redmine Admin | * Make sure you enable document validation in the server, otherwise results might be unexpected |
| 124 | 1 | Redmine Admin | |
| 125 | 20 | Adrian Georgescu | == xcapclient == |
| 126 | 1 | Redmine Admin | |
| 127 | 15 | Adrian Georgescu | A command line client is available part of python-xcaplib, which is available as a tar archive and Debian package. |
| 128 | 14 | Adrian Georgescu | |
| 129 | 14 | Adrian Georgescu | The client can be used to manipulate full or partial XML |
| 130 | 1 | Redmine Admin | documents on XCAP servers (not limited to OpenXCAP) and has a bash shell |
| 131 | 1 | Redmine Admin | command line completion facility that makes it very easy to browse through |
| 132 | 1 | Redmine Admin | the structure of XML documents based on XPATH. |
| 133 | 1 | Redmine Admin | |
| 134 | 14 | Adrian Georgescu | First create xcapclient configuration file: |
| 135 | 11 | Adrian Georgescu | |
| 136 | 11 | Adrian Georgescu | {{{ |
| 137 | 11 | Adrian Georgescu | ~/.xcapclient.ini |
| 138 | 11 | Adrian Georgescu | }}} |
| 139 | 11 | Adrian Georgescu | |
| 140 | 11 | Adrian Georgescu | with your credentials and XCAP root. |
| 141 | 11 | Adrian Georgescu | |
| 142 | 11 | Adrian Georgescu | {{{ |
| 143 | 30 | Redmine Admin | # this will be the default account used by xcapclient |
| 144 | 11 | Adrian Georgescu | [Account] |
| 145 | 11 | Adrian Georgescu | sip_address=alice@example.com |
| 146 | 31 | Adrian Georgescu | password=1234 |
| 147 | 11 | Adrian Georgescu | xcap_root = https://xcap.example.com/xcap-root |
| 148 | 30 | Redmine Admin | |
| 149 | 30 | Redmine Admin | # this will be used when -a bob command-line switch is provided |
| 150 | 30 | Redmine Admin | [Account_bob] |
| 151 | 30 | Redmine Admin | sip_address = bob@example.com |
| 152 | 31 | Adrian Georgescu | password = 1234 |
| 153 | 30 | Redmine Admin | xcap_root = https://xcap.example.com/xcap-root |
| 154 | 30 | Redmine Admin | }}} |
| 155 | 30 | Redmine Admin | |
| 156 | 30 | Redmine Admin | Multiple accounts can be specified. In order to select a specific account, the '-a' switch must be used: |
| 157 | 30 | Redmine Admin | |
| 158 | 30 | Redmine Admin | {{{ |
| 159 | 30 | Redmine Admin | # use default account ('Account' section) |
| 160 | 30 | Redmine Admin | xcapclient --app xcap-caps GET |
| 161 | 30 | Redmine Admin | |
| 162 | 30 | Redmine Admin | # use Bob's account ('Account_bob' section) |
| 163 | 30 | Redmine Admin | xcapclient -a bob --app xcap-caps GET |
| 164 | 11 | Adrian Georgescu | }}} |
| 165 | 1 | Redmine Admin | |
| 166 | 2 | Redmine Admin | Operating on XCAP documents (full document handling) |
| 167 | 1 | Redmine Admin | |
| 168 | 3 | Redmine Admin | In the examples folder there are sample XCAP XML documents used for the examples below: |
| 169 | 2 | Redmine Admin | |
| 170 | 20 | Adrian Georgescu | === PUT === |
| 171 | 2 | Redmine Admin | |
| 172 | 2 | Redmine Admin | To a document, for example, presence rules: |
| 173 | 2 | Redmine Admin | |
| 174 | 2 | Redmine Admin | {{{ |
| 175 | 2 | Redmine Admin | xcapclient -i pres-rules.xml put |
| 176 | 2 | Redmine Admin | }}} |
| 177 | 2 | Redmine Admin | |
| 178 | 2 | Redmine Admin | On success, the command prints '201 Created' if a new document was created on the server or '200 OK' if an existing document was replaced. You should something like this: |
| 179 | 2 | Redmine Admin | |
| 180 | 1 | Redmine Admin | {{{ |
| 181 | 2 | Redmine Admin | url: http://xcap.example.com/xcap-root/resource-lists/users/alice@example.com/index.xml |
| 182 | 1 | Redmine Admin | 201 Created |
| 183 | 2 | Redmine Admin | etag: "856bdac9012ee28e46cebb81e51ac2a0" |
| 184 | 2 | Redmine Admin | }}} |
| 185 | 2 | Redmine Admin | |
| 186 | 20 | Adrian Georgescu | === GET === |
| 187 | 2 | Redmine Admin | |
| 188 | 2 | Redmine Admin | {{{ |
| 189 | 2 | Redmine Admin | xcapclient --app resource-lists get |
| 190 | 2 | Redmine Admin | }}} |
| 191 | 2 | Redmine Admin | |
| 192 | 2 | Redmine Admin | or |
| 193 | 2 | Redmine Admin | |
| 194 | 2 | Redmine Admin | {{{ |
| 195 | 2 | Redmine Admin | xcapclient --app pres-rules get |
| 196 | 2 | Redmine Admin | }}} |
| 197 | 2 | Redmine Admin | |
| 198 | 2 | Redmine Admin | or |
| 199 | 2 | Redmine Admin | |
| 200 | 2 | Redmine Admin | {{{ |
| 201 | 2 | Redmine Admin | xcapclient --app rls-services get |
| 202 | 2 | Redmine Admin | }}} |
| 203 | 2 | Redmine Admin | |
| 204 | 2 | Redmine Admin | This will print the document you've just put, along with its tag. |
| 205 | 2 | Redmine Admin | |
| 206 | 2 | Redmine Admin | or |
| 207 | 2 | Redmine Admin | |
| 208 | 2 | Redmine Admin | {{{ |
| 209 | 1 | Redmine Admin | xcapclient --app xcap-caps get |
| 210 | 2 | Redmine Admin | }}} |
| 211 | 2 | Redmine Admin | |
| 212 | 2 | Redmine Admin | will print the capabilities of the XCAP server. |
| 213 | 2 | Redmine Admin | |
| 214 | 20 | Adrian Georgescu | === DELETE === |
| 215 | 2 | Redmine Admin | |
| 216 | 2 | Redmine Admin | {{{ |
| 217 | 2 | Redmine Admin | xcapclient --app resource-lists delete |
| 218 | 2 | Redmine Admin | }}} |
| 219 | 2 | Redmine Admin | |
| 220 | 2 | Redmine Admin | and |
| 221 | 2 | Redmine Admin | |
| 222 | 2 | Redmine Admin | {{{ |
| 223 | 2 | Redmine Admin | xcapclient --app pres-rules delete |
| 224 | 2 | Redmine Admin | }}} |
| 225 | 2 | Redmine Admin | |
| 226 | 2 | Redmine Admin | and |
| 227 | 2 | Redmine Admin | |
| 228 | 2 | Redmine Admin | {{{ |
| 229 | 2 | Redmine Admin | xcapclient --app rls-services delete |
| 230 | 2 | Redmine Admin | }}} |
| 231 | 2 | Redmine Admin | |
| 232 | 2 | Redmine Admin | Operating on XML elements (partial document handling) |
| 233 | 2 | Redmine Admin | |
| 234 | 2 | Redmine Admin | It is possible to retrieve a single element in XCAP document, to replace it, to insert a new one or to remove one. To address an element, a node selector is required, which is an XPATH-like expression, defined in http://tools.ietf.org/html/rfc4825#section-6.3. |
| 235 | 2 | Redmine Admin | |
| 236 | 2 | Redmine Admin | Let's put the document in section 1 again to server, so we can fetch some elements from it. |
| 237 | 2 | Redmine Admin | |
| 238 | 2 | Redmine Admin | {{{ |
| 239 | 2 | Redmine Admin | xcapclient --app resource-lists get '/resource-lists/list[@name="friends"]/entry[1]/display-name' |
| 240 | 2 | Redmine Admin | }}} |
| 241 | 2 | Redmine Admin | |
| 242 | 2 | Redmine Admin | {{{ |
| 243 | 2 | Redmine Admin | etag: "856bdac9012ee28e46cebb81e51ac2a0" |
| 244 | 2 | Redmine Admin | <display-name>Bill Doe</display-name> |
| 245 | 2 | Redmine Admin | }}} |
| 246 | 2 | Redmine Admin | |
| 247 | 2 | Redmine Admin | Specifying application with --app, is no longer necessary as it may be guessed from the node selector. |
| 248 | 2 | Redmine Admin | |
| 249 | 29 | Adrian Georgescu | To replace an element, use the node selector you would have used for retrieving the element but do PUT instead. For example if we want to fix Bill's display name: |
| 250 | 2 | Redmine Admin | |
| 251 | 2 | Redmine Admin | {{{ |
| 252 | 2 | Redmine Admin | xcapclient -i bill_display_name_fixed.xml put '/resource-lists/list[@name="friends"]/entry[1]/display-name' |
| 253 | 2 | Redmine Admin | }}} |
| 254 | 2 | Redmine Admin | |
| 255 | 2 | Redmine Admin | To insert a new element one must construct a node selector that doesn't point to an existing element. |
| 256 | 2 | Redmine Admin | |
| 257 | 2 | Redmine Admin | {{{ |
| 258 | 2 | Redmine Admin | xcapclient -i alice.xml put '/resource-lists/list[@name="friends"]/entry[1][@uri="sip:alice@example.com"]' |
| 259 | 2 | Redmine Admin | }}} |
| 260 | 2 | Redmine Admin | |
| 261 | 2 | Redmine Admin | {{{ |
| 262 | 2 | Redmine Admin | 201 Created |
| 263 | 2 | Redmine Admin | etag: "bfbd38bed7163dd19e6e110d0dfa0876" |
| 264 | 2 | Redmine Admin | }}} |
| 265 | 2 | Redmine Admin | |
| 266 | 2 | Redmine Admin | This will shift Bill's entry to the second position. |
| 267 | 1 | Redmine Admin | |
| 268 | 4 | Redmine Admin | See README of python-xcaplib package for more detailed examples on how to create/retrieve XCAP documents. |
| 269 | 1 | Redmine Admin | |
| 270 | 22 | Adrian Georgescu | == SIP SIMPLE client SDK == |
| 271 | 4 | Redmine Admin | |
| 272 | 8 | Adrian Georgescu | You can download the command Line Tools for SIP SIMPLE client SDK from http://SipSimpleClient.com |
| 273 | 8 | Adrian Georgescu | |
| 274 | 8 | Adrian Georgescu | Create an account: |
| 275 | 8 | Adrian Georgescu | |
| 276 | 8 | Adrian Georgescu | {{{ |
| 277 | 8 | Adrian Georgescu | sip-settings -a add user@domain |
| 278 | 8 | Adrian Georgescu | }}} |
| 279 | 8 | Adrian Georgescu | |
| 280 | 8 | Adrian Georgescu | Set the newly created account as default: |
| 281 | 8 | Adrian Georgescu | |
| 282 | 8 | Adrian Georgescu | {{{ |
| 283 | 8 | Adrian Georgescu | sip-settings -a default user@domain |
| 284 | 8 | Adrian Georgescu | }}} |
| 285 | 8 | Adrian Georgescu | |
| 286 | 8 | Adrian Georgescu | Set the xcap root: |
| 287 | 8 | Adrian Georgescu | |
| 288 | 8 | Adrian Georgescu | {{{ |
| 289 | 8 | Adrian Georgescu | sip-settings -a set xcap.xcap_root=http://xcap.example.com/xcap-root/ |
| 290 | 8 | Adrian Georgescu | sip-settings -a set xcap.enabled=True |
| 291 | 8 | Adrian Georgescu | }}} |
| 292 | 1 | Redmine Admin | |
| 293 | 7 | Adrian Georgescu | The following Command Line Tools are available for testing XCAP: |
| 294 | 7 | Adrian Georgescu | |
| 295 | 7 | Adrian Georgescu | * Manage pres-rules document: [http://sipsimpleclient.com/wiki/xcap_pres_rules xcap-pres-rules] |
| 296 | 7 | Adrian Georgescu | * Manage rls-services document: [http://sipsimpleclient.com/wiki/xcap_rls_services xcap-rls-services] |
| 297 | 7 | Adrian Georgescu | * Manage icon: [http://sipsimpleclient.com/wiki/xcap_icon xcap-icon] |
| 298 | 7 | Adrian Georgescu | * Retrieve xcap-directory document: [http://sipsimpleclient.com/wiki/xcap_directory xcap-directory] |