robotframework-plugins 2026.11.0.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- robotframework_plugins/__init__.py +14 -0
- robotframework_plugins/_assets/catalog.json +143 -0
- robotframework_plugins/_assets/plugins/rf-agentskills/.claude-plugin/plugin.json +25 -0
- robotframework_plugins/_assets/plugins/rf-agentskills/CHANGELOG.md +198 -0
- robotframework_plugins/_assets/plugins/rf-agentskills/README.md +27 -0
- robotframework_plugins/_assets/plugins/rf-agentskills/catalog.yaml +25 -0
- robotframework_plugins/_assets/plugins/rf-api/.claude-plugin/plugin.json +25 -0
- robotframework_plugins/_assets/plugins/rf-api/CHANGELOG.md +9 -0
- robotframework_plugins/_assets/plugins/rf-api/README.md +27 -0
- robotframework_plugins/_assets/plugins/rf-api/catalog.yaml +27 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/SKILL.md +110 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/authentication-patterns.robot +39 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/basic-crud.robot +46 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/file-upload.robot +28 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/session-handling.robot +48 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/authentication.md +58 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/install.md +10 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/request-options.md +90 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/response-validation.md +64 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/troubleshooting.md +64 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/SKILL.md +119 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/assets/examples/basic-rest.robot +51 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/assets/examples/schema-validation.robot +38 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/assets/examples/schemas/user.json +10 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/authentication.md +61 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/install.md +11 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/json-handling.md +89 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/migrate-from-requests.md +15 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/schema-validation.md +85 -0
- robotframework_plugins/_assets/plugins/rf-api/skills/rf-restinstance/references/troubleshooting.md +68 -0
- robotframework_plugins/_assets/plugins/rf-core/.claude-plugin/plugin.json +19 -0
- robotframework_plugins/_assets/plugins/rf-core/CHANGELOG.md +11 -0
- robotframework_plugins/_assets/plugins/rf-core/README.md +38 -0
- robotframework_plugins/_assets/plugins/rf-core/agents/rf-debug-expert.md +104 -0
- robotframework_plugins/_assets/plugins/rf-core/agents/rf-migration-guide.md +73 -0
- robotframework_plugins/_assets/plugins/rf-core/agents/rf-test-architect.md +98 -0
- robotframework_plugins/_assets/plugins/rf-core/catalog.yaml +19 -0
- robotframework_plugins/_assets/plugins/rf-core/hooks/README.md +435 -0
- robotframework_plugins/_assets/plugins/rf-core/hooks/hooks.json +70 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/_hook_input.mjs +101 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/_pending_errors.mjs +65 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/_python_env.mjs +181 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/check_rf_environment.mjs +181 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/maybe_inject_rf_context.mjs +74 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/maybe_remind_robot_tests.mjs +108 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/report_pending_errors.mjs +72 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/rf_error_hints.mjs +126 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/validate_robot.mjs +509 -0
- robotframework_plugins/_assets/plugins/rf-core/scripts/validate_robot_project.mjs +103 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/SKILL.md +313 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/api.resource +30 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/calc.resource +23 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/embedded.resource +20 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/keywords.resource +26 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/resources/login.resource +10 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/01__keyword_driven.robot +15 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/02__data_driven.robot +10 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/03__templates.robot +17 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/04__bdd.robot +10 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/05__embedded.robot +13 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/__init__.robot +6 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/api/__init__.robot +7 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/api/users.robot +18 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/tests/env.robot +15 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/variables/common.py +11 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/variables/dev.yaml +3 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/assets/examples/variables/staging.yaml +3 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/arguments.md +139 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/control-structures.md +175 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/embedded-arguments.md +135 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/migration.md +90 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/resources-and-variable-files.md +127 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/styles.md +92 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/suites-and-init.md +96 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/tags-and-selection.md +104 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/templates.md +124 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/references/variables-and-scopes.md +129 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-language/scripts/rf_conventions.py +883 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/SKILL.md +216 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/ExampleLibrary.py +61 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/ResultListener.py +60 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/converters.py +48 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/converters.robot +20 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/example_library.robot +31 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/assets/examples/listener.robot +12 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/api-variants.md +291 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/communication.md +248 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/conversion.md +347 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/listeners.md +150 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/references/packaging-and-docs.md +155 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-python-library/scripts/check_library.py +842 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/SKILL.md +159 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/github-actions-robot.yml +32 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/gitignore.txt +22 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/pyproject.poetry.toml +28 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/pyproject.uv.toml +20 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/requirements.txt +9 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/robot.toml +16 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/assets/examples/smoke.robot +22 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/ci.md +61 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/cli-tools.md +33 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/libraries.md +47 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/poetry.md +77 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/project-layout.md +86 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/troubleshooting.md +73 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/uv.md +108 -0
- robotframework_plugins/_assets/plugins/rf-core/skills/rf-setup/references/venv-pip.md +71 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/codex/agents/rf-debug-expert.toml +103 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/codex/agents/rf-migration-guide.toml +72 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/codex/agents/rf-test-architect.toml +97 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/opencode/agents/rf-debug-expert.md +107 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/opencode/agents/rf-migration-guide.md +76 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/opencode/agents/rf-test-architect.md +101 -0
- robotframework_plugins/_assets/plugins/rf-core/variants/opencode/plugins/rf-core.js +93 -0
- robotframework_plugins/_assets/plugins/rf-desktop/.claude-plugin/plugin.json +24 -0
- robotframework_plugins/_assets/plugins/rf-desktop/CHANGELOG.md +9 -0
- robotframework_plugins/_assets/plugins/rf-desktop/README.md +26 -0
- robotframework_plugins/_assets/plugins/rf-desktop/catalog.yaml +23 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/SKILL.md +266 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/assets/examples/calculator.robot +45 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/assets/examples/mock-deterministic.robot +33 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/cli-and-inspector.md +82 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/install.md +14 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/keywords-reference.md +102 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/locators-and-queries.md +95 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/platform-setup.md +65 -0
- robotframework_plugins/_assets/plugins/rf-desktop/skills/rf-platynui/references/status-and-migration.md +41 -0
- robotframework_plugins/_assets/plugins/rf-mobile/.claude-plugin/plugin.json +24 -0
- robotframework_plugins/_assets/plugins/rf-mobile/CHANGELOG.md +9 -0
- robotframework_plugins/_assets/plugins/rf-mobile/README.md +26 -0
- robotframework_plugins/_assets/plugins/rf-mobile/catalog.yaml +23 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/SKILL.md +134 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/android-basic.robot +60 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/gestures-example.robot +59 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/hybrid-app.robot +54 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/assets/examples/ios-basic.robot +48 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/capabilities.md +117 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/gestures-touch.md +84 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/install.md +21 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/locators-mobile.md +74 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/platform-specific.md +105 -0
- robotframework_plugins/_assets/plugins/rf-mobile/skills/rf-appium/references/troubleshooting.md +70 -0
- robotframework_plugins/_assets/plugins/rf-web/.claude-plugin/plugin.json +25 -0
- robotframework_plugins/_assets/plugins/rf-web/CHANGELOG.md +9 -0
- robotframework_plugins/_assets/plugins/rf-web/README.md +27 -0
- robotframework_plugins/_assets/plugins/rf-web/catalog.yaml +27 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/SKILL.md +132 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/authentication-flow.robot +34 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/basic-web-test.robot +29 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/form-handling.robot +49 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/assets/examples/iframe-shadow-dom.robot +31 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/assertion-engine.md +79 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/authentication-storage.md +86 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/browser-context-page.md +110 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/downloads-uploads.md +51 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/iframes-shadow-dom.md +67 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/install.md +67 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/locators.md +83 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/migrate-from-selenium.md +22 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-browser/references/troubleshooting.md +100 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/SKILL.md +123 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/basic-web-test.robot +64 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/multi-window.robot +55 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/assets/examples/wait-patterns.robot +53 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/browser-setup.md +103 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/frames-windows.md +84 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/install.md +12 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/javascript-execution.md +65 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/locators.md +86 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/troubleshooting.md +122 -0
- robotframework_plugins/_assets/plugins/rf-web/skills/rf-selenium/references/waiting-strategies.md +84 -0
- robotframework_plugins/_assets.py +120 -0
- robotframework_plugins/_catalog.py +123 -0
- robotframework_plugins/_snapshot.py +230 -0
- robotframework_plugins/adapters/__init__.py +53 -0
- robotframework_plugins/adapters/_base.py +400 -0
- robotframework_plugins/adapters/claude_code.py +312 -0
- robotframework_plugins/adapters/claude_desktop.py +129 -0
- robotframework_plugins/adapters/codex.py +276 -0
- robotframework_plugins/adapters/copilot.py +87 -0
- robotframework_plugins/adapters/cursor.py +295 -0
- robotframework_plugins/adapters/goose.py +240 -0
- robotframework_plugins/adapters/opencode.py +170 -0
- robotframework_plugins/bundle.py +85 -0
- robotframework_plugins/cli.py +1311 -0
- robotframework_plugins/detect.py +121 -0
- robotframework_plugins/manifest.py +338 -0
- robotframework_plugins/py.typed +0 -0
- robotframework_plugins/skillzip.py +39 -0
- robotframework_plugins/transforms.py +725 -0
- robotframework_plugins-2026.11.0.dev1.dist-info/METADATA +178 -0
- robotframework_plugins-2026.11.0.dev1.dist-info/RECORD +195 -0
- robotframework_plugins-2026.11.0.dev1.dist-info/WHEEL +4 -0
- robotframework_plugins-2026.11.0.dev1.dist-info/entry_points.txt +2 -0
- robotframework_plugins-2026.11.0.dev1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation Authentication with RequestsLibrary: basic (session and sessionless), bearer token,
|
|
3
|
+
... API key and a negative 401 test on a separate session.
|
|
4
|
+
Library RequestsLibrary
|
|
5
|
+
Suite Teardown Delete All Sessions
|
|
6
|
+
|
|
7
|
+
*** Variables ***
|
|
8
|
+
${API_URL} https://api.example.com
|
|
9
|
+
${USER} admin
|
|
10
|
+
${PASSWORD} secret
|
|
11
|
+
${API_KEY} %{API_KEY=dummy-key}
|
|
12
|
+
|
|
13
|
+
*** Test Cases ***
|
|
14
|
+
Basic Auth On A Session
|
|
15
|
+
VAR @{creds} ${USER} ${PASSWORD}
|
|
16
|
+
Create Session basic ${API_URL} auth=${creds} verify=${True}
|
|
17
|
+
GET On Session basic /protected
|
|
18
|
+
|
|
19
|
+
Basic Auth Sessionless Needs A Tuple
|
|
20
|
+
${creds}= Evaluate ($USER, $PASSWORD)
|
|
21
|
+
GET ${API_URL}/protected auth=${creds}
|
|
22
|
+
|
|
23
|
+
Bearer Token From Login
|
|
24
|
+
Create Session app ${API_URL} verify=${True}
|
|
25
|
+
VAR &{login} username=${USER} password=${PASSWORD}
|
|
26
|
+
${resp}= POST On Session app /auth/login json=${login}
|
|
27
|
+
VAR &{auth} Authorization=Bearer ${resp.json()}[access_token]
|
|
28
|
+
Update Session app headers=${auth}
|
|
29
|
+
${me}= GET On Session app /users/me
|
|
30
|
+
Should Be Equal ${me.json()}[username] ${USER}
|
|
31
|
+
|
|
32
|
+
API Key In A Header
|
|
33
|
+
VAR &{key} X-API-Key=${API_KEY}
|
|
34
|
+
Create Session keyed ${API_URL} headers=${key} verify=${True}
|
|
35
|
+
GET On Session keyed /data
|
|
36
|
+
|
|
37
|
+
Missing Credentials Are Rejected
|
|
38
|
+
Create Session anonymous ${API_URL} verify=${True}
|
|
39
|
+
GET On Session anonymous /protected expected_status=401
|
robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/basic-crud.robot
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation CRUD lifecycle against a JSON API with one RequestsLibrary session.
|
|
3
|
+
... Point ${API_URL} at the system under test (dry run needs no server).
|
|
4
|
+
Library RequestsLibrary
|
|
5
|
+
Library Collections
|
|
6
|
+
Suite Setup Create Session api ${API_URL} verify=${True} timeout=10
|
|
7
|
+
Suite Teardown Delete All Sessions
|
|
8
|
+
|
|
9
|
+
*** Variables ***
|
|
10
|
+
${API_URL} https://api.example.com
|
|
11
|
+
|
|
12
|
+
*** Test Cases ***
|
|
13
|
+
Create, Read, Update And Delete A User
|
|
14
|
+
VAR &{new} name=John Doe email=john@example.com age=${30}
|
|
15
|
+
${resp}= POST On Session api /users json=${new} expected_status=201
|
|
16
|
+
VAR ${user_id} ${resp.json()}[id]
|
|
17
|
+
|
|
18
|
+
${resp}= GET On Session api /users/${user_id}
|
|
19
|
+
Validate User ${resp.json()} John Doe
|
|
20
|
+
|
|
21
|
+
VAR &{changes} name=John Updated
|
|
22
|
+
${resp}= PATCH On Session api /users/${user_id} json=${changes}
|
|
23
|
+
Should Be Equal ${resp.json()}[name] John Updated
|
|
24
|
+
|
|
25
|
+
DELETE On Session api /users/${user_id} expected_status=204
|
|
26
|
+
GET On Session api /users/${user_id} expected_status=404
|
|
27
|
+
|
|
28
|
+
List Users With Paging
|
|
29
|
+
VAR &{page} _page=1 _limit=5
|
|
30
|
+
${resp}= GET On Session api /users params=${page}
|
|
31
|
+
${users}= Set Variable ${resp.json()}
|
|
32
|
+
Should Be True len($users) <= 5
|
|
33
|
+
FOR ${user} IN @{users}
|
|
34
|
+
Dictionary Should Contain Key ${user} email
|
|
35
|
+
END
|
|
36
|
+
|
|
37
|
+
Unknown User Returns 404
|
|
38
|
+
${resp}= GET On Session api /users/999999 expected_status=anything
|
|
39
|
+
Status Should Be not found ${resp}
|
|
40
|
+
|
|
41
|
+
*** Keywords ***
|
|
42
|
+
Validate User
|
|
43
|
+
[Arguments] ${user} ${expected_name}
|
|
44
|
+
Dictionary Should Contain Key ${user} id
|
|
45
|
+
Should Be Equal ${user}[name] ${expected_name}
|
|
46
|
+
Should Match Regexp ${user}[email] ^\\S+@\\S+$
|
robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/assets/examples/file-upload.robot
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation Multipart upload with files=, streaming upload with data=, and download to disk.
|
|
3
|
+
Library RequestsLibrary
|
|
4
|
+
Library OperatingSystem
|
|
5
|
+
Suite Setup Create Session api ${API_URL} verify=${True} timeout=60
|
|
6
|
+
Suite Teardown Delete All Sessions
|
|
7
|
+
|
|
8
|
+
*** Variables ***
|
|
9
|
+
${API_URL} https://api.example.com
|
|
10
|
+
${REPORT} ${CURDIR}/report.csv
|
|
11
|
+
|
|
12
|
+
*** Test Cases ***
|
|
13
|
+
Upload A File As Multipart Form Data
|
|
14
|
+
${fh}= Evaluate open($REPORT, 'rb')
|
|
15
|
+
VAR &{files} file=${{('report.csv', $fh, 'text/csv')}}
|
|
16
|
+
VAR &{fields} description=monthly report
|
|
17
|
+
${resp}= POST On Session api /upload files=${files} data=${fields} expected_status=201
|
|
18
|
+
Should Be Equal ${resp.json()}[filename] report.csv
|
|
19
|
+
|
|
20
|
+
Stream A Large File As The Request Body
|
|
21
|
+
${stream}= Get File For Streaming Upload ${REPORT}
|
|
22
|
+
VAR &{type} Content-Type=application/octet-stream
|
|
23
|
+
PUT On Session api /blobs/report data=${stream} headers=${type}
|
|
24
|
+
|
|
25
|
+
Download A File
|
|
26
|
+
${resp}= GET On Session api /reports/latest
|
|
27
|
+
Create Binary File ${OUTPUT_DIR}/latest.csv ${resp.content}
|
|
28
|
+
File Should Not Be Empty ${OUTPUT_DIR}/latest.csv
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation Session patterns: shared defaults, per-request overrides, token after login,
|
|
3
|
+
... retries and several APIs in one suite.
|
|
4
|
+
Library RequestsLibrary
|
|
5
|
+
Suite Setup Open API Sessions
|
|
6
|
+
Suite Teardown Delete All Sessions
|
|
7
|
+
|
|
8
|
+
*** Variables ***
|
|
9
|
+
${API_URL} https://api.example.com
|
|
10
|
+
${ORDERS_URL} https://orders.example.com
|
|
11
|
+
${USER} demo
|
|
12
|
+
${PASSWORD} demo
|
|
13
|
+
|
|
14
|
+
*** Test Cases ***
|
|
15
|
+
Session Headers Apply To Every Call
|
|
16
|
+
${resp}= GET On Session api /me
|
|
17
|
+
Should Start With ${resp.headers}[content-type] application/json
|
|
18
|
+
|
|
19
|
+
Per Request Headers Are Merged Over Session Headers
|
|
20
|
+
VAR &{extra} X-Request-Id=test-123
|
|
21
|
+
${resp}= GET On Session api /me headers=${extra}
|
|
22
|
+
|
|
23
|
+
Token Added After Login
|
|
24
|
+
Log In As ${USER} ${PASSWORD}
|
|
25
|
+
GET On Session api /orders
|
|
26
|
+
|
|
27
|
+
Query Parameters Go In Params
|
|
28
|
+
VAR &{query} q=robot framework limit=10
|
|
29
|
+
${resp}= GET On Session api /search params=${query}
|
|
30
|
+
|
|
31
|
+
Two APIs In One Suite
|
|
32
|
+
${user}= GET On Session api /users/1
|
|
33
|
+
${orders}= GET On Session orders /orders params=${{{'user': $user.json()['id']}}}
|
|
34
|
+
|
|
35
|
+
*** Keywords ***
|
|
36
|
+
Open API Sessions
|
|
37
|
+
VAR &{json} Accept=application/json
|
|
38
|
+
Create Session api ${API_URL} headers=${json} verify=${True} timeout=10
|
|
39
|
+
VAR @{retry_on} 502 503
|
|
40
|
+
Create Session orders ${ORDERS_URL} headers=${json} verify=${True}
|
|
41
|
+
... max_retries=3 retry_status_list=${retry_on}
|
|
42
|
+
|
|
43
|
+
Log In As
|
|
44
|
+
[Arguments] ${user} ${password}
|
|
45
|
+
VAR &{creds} username=${user} password=${password}
|
|
46
|
+
${resp}= POST On Session api /auth/login json=${creds} expected_status=200
|
|
47
|
+
VAR &{auth} Authorization=Bearer ${resp.json()}[access_token]
|
|
48
|
+
Update Session api headers=${auth}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Authentication
|
|
2
|
+
|
|
3
|
+
| Scheme | Session keyword / argument | Sessionless |
|
|
4
|
+
|---|---|---|
|
|
5
|
+
| Basic | `Create Session api ${URL} auth=${list}` | `auth=${tuple}` |
|
|
6
|
+
| Digest | `Create Digest Session api ${URL} auth=${list}` | `auth=${digest}` object |
|
|
7
|
+
| NTLM | `Create Ntlm Session api ${URL} auth=${list}` (domain, user, password) | — |
|
|
8
|
+
| Client certificate (mTLS) | `Create Client Cert Session api ${URL} client_certs=${certs}` | `cert=${tuple}` |
|
|
9
|
+
| Bearer token / API key | `headers=` on `Create Session`, or `Update Session` after login | `headers=${headers}` |
|
|
10
|
+
| Custom `requests` auth object | `Create Custom Session api ${URL} auth=${obj}` | `auth=${obj}` |
|
|
11
|
+
|
|
12
|
+
## Basic and digest
|
|
13
|
+
|
|
14
|
+
`Create Session` wraps a two-item list in `HTTPBasicAuth`; `Create Digest Session` wraps it in `HTTPDigestAuth`. Sessionless keywords pass `auth=` straight to `requests`, which accepts a tuple but not a list (a list fails with `TypeError: 'list' object is not callable`).
|
|
15
|
+
|
|
16
|
+
```robotframework
|
|
17
|
+
VAR @{creds} ${USER} ${PASSWORD}
|
|
18
|
+
Create Session api ${API_URL} auth=${creds} verify=${True}
|
|
19
|
+
|
|
20
|
+
${basic}= Evaluate ($USER, $PASSWORD)
|
|
21
|
+
${resp}= GET ${API_URL}/protected auth=${basic}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## NTLM
|
|
25
|
+
|
|
26
|
+
`Create Ntlm Session` needs the `requests_ntlm` package in the project environment (otherwise: `requests_ntlm module not installed`) and exactly three items: domain, user, password.
|
|
27
|
+
|
|
28
|
+
```robotframework
|
|
29
|
+
VAR @{ntlm} CORP ${USER} ${PASSWORD}
|
|
30
|
+
Create Ntlm Session api ${API_URL} auth=${ntlm} verify=${True}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Client certificates
|
|
34
|
+
|
|
35
|
+
```robotframework
|
|
36
|
+
VAR @{certs} ${CURDIR}/client.crt ${CURDIR}/client.key
|
|
37
|
+
Create Client Cert Session api ${API_URL} client_certs=${certs} verify=${CURDIR}/ca.pem
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Token obtained at runtime
|
|
41
|
+
|
|
42
|
+
Log in once, then add the header to the existing session so every later call sends it:
|
|
43
|
+
|
|
44
|
+
```robotframework
|
|
45
|
+
*** Keywords ***
|
|
46
|
+
Log In As
|
|
47
|
+
[Arguments] ${user} ${password}
|
|
48
|
+
VAR &{creds} username=${user} password=${password}
|
|
49
|
+
${resp}= POST On Session api /auth/login json=${creds} expected_status=200
|
|
50
|
+
VAR &{auth} Authorization=Bearer ${resp.json()}[access_token]
|
|
51
|
+
Update Session api headers=${auth}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Session headers are global to the library: a token set in one test is still sent by later tests and suites until `Delete All Sessions` or a new `Create Session` with the same alias. For a request that has to go out without the token (for example a 401 test), use a second alias or a sessionless call.
|
|
55
|
+
|
|
56
|
+
Per-request `headers=` on an `… On Session` call are merged over the session headers for that call only.
|
|
57
|
+
|
|
58
|
+
Keep secrets out of the log: pass them as variables from the command line or environment (`%{API_TOKEN}`), not as literals in the suite.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Installing RequestsLibrary
|
|
2
|
+
|
|
3
|
+
Commands are in uv form. For a new environment, Poetry and venv + pip forms, and the general troubleshooting (wrong interpreter, PEP 668, old Python), see `rf-setup` (plugin `rf-core`): `uv add <pkg>` is `poetry add <pkg>` (pip alternative: `.venv/bin/python -m pip install <pkg>`), and `uv run <cmd>` is `poetry run <cmd>` or `.venv/bin/<cmd>`. Versions and floors checked on PyPI 2026-09-26.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
uv add robotframework-requests
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
- Package `robotframework-requests` (0.9.7). Module `RequestsLibrary`. No step after installing.
|
|
10
|
+
- Verify: `uv run python -c "import RequestsLibrary"`.
|
robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/request-options.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Request Options
|
|
2
|
+
|
|
3
|
+
- [Sessionless vs session keywords](#sessionless-vs-session-keywords)
|
|
4
|
+
- [expected_status](#expected_status)
|
|
5
|
+
- [Body: json, data, files](#body-json-data-files)
|
|
6
|
+
- [Query parameters and headers](#query-parameters-and-headers)
|
|
7
|
+
- [Timeouts, retries and redirects](#timeouts-retries-and-redirects)
|
|
8
|
+
- [TLS: verify and cert](#tls-verify-and-cert)
|
|
9
|
+
- [Session-level options](#session-level-options)
|
|
10
|
+
|
|
11
|
+
## Sessionless vs session keywords
|
|
12
|
+
|
|
13
|
+
| Style | Keywords | First argument |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| Sessionless | `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD`, `OPTIONS` | full URL |
|
|
16
|
+
| Session | `GET On Session`, `POST On Session`, … (same verbs + ` On Session`) | alias, then a path |
|
|
17
|
+
|
|
18
|
+
A session call joins the path to the session URL: `Create Session api http://host/v1` plus `GET On Session api /users` requests `/v1/users` (the leading `/` is dropped before joining). A full URL passed to an `… On Session` keyword replaces the base URL but keeps the session's headers, cookies and auth.
|
|
19
|
+
|
|
20
|
+
Sessionless calls use plain `requests` defaults (TLS verification on, no retries). Session calls use the session's settings (see below).
|
|
21
|
+
|
|
22
|
+
```robotframework
|
|
23
|
+
${resp}= GET https://api.example.com/health
|
|
24
|
+
Create Session api https://api.example.com verify=${True}
|
|
25
|
+
${resp}= GET On Session api /users params=${params}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## expected_status
|
|
29
|
+
|
|
30
|
+
Every request keyword checks the status itself:
|
|
31
|
+
|
|
32
|
+
| Value | Behaviour |
|
|
33
|
+
|---|---|
|
|
34
|
+
| not set (default) | fails with `HTTPError` on any 4xx or 5xx |
|
|
35
|
+
| `201`, `404` | fails unless the status equals that code (`Expected status: 200 != 201`) |
|
|
36
|
+
| `${201}` (an integer variable) | not supported: `InvalidExpectedStatus`; the value must be a string |
|
|
37
|
+
| `created`, `not found`, `not_found` | status names from `requests.codes` |
|
|
38
|
+
| `any` / `anything` | no check; assert later with `Status Should Be` |
|
|
39
|
+
| `2xx`, `4xx`, a list | not supported: `UnknownStatusError` |
|
|
40
|
+
|
|
41
|
+
```robotframework
|
|
42
|
+
${resp}= GET ${URL}/users/99 expected_status=404
|
|
43
|
+
${resp}= POST On Session api /users json=${user} expected_status=201
|
|
44
|
+
${resp}= GET On Session api /maybe expected_status=anything
|
|
45
|
+
Request Should Be Successful ${resp}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`msg=` adds a custom failure message to the status check.
|
|
49
|
+
|
|
50
|
+
## Body: json, data, files
|
|
51
|
+
|
|
52
|
+
- `json=${dict}` or a list: serialized with `Content-Type: application/json`.
|
|
53
|
+
- `data=${dict}`: `application/x-www-form-urlencoded`. `data=${string}`: raw body, set `Content-Type` yourself.
|
|
54
|
+
- `files=${files}`: multipart upload. Each value is a file object or a tuple `(filename, fileobj, content_type)`.
|
|
55
|
+
- `Get File For Streaming Upload path` returns a binary file object to pass as `data=` for large uploads; the library closes it after the request.
|
|
56
|
+
|
|
57
|
+
```robotframework
|
|
58
|
+
VAR &{user} name=Alice age=${30} active=${True}
|
|
59
|
+
${resp}= POST On Session api /users json=${user}
|
|
60
|
+
${file}= Get File For Streaming Upload ${CURDIR}/data.bin
|
|
61
|
+
${resp}= PUT On Session api /blob data=${file}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Values written in `VAR` / `Create Dictionary` are strings unless you use `${30}`, `${True}`, `${None}`.
|
|
65
|
+
|
|
66
|
+
## Query parameters and headers
|
|
67
|
+
|
|
68
|
+
- `params=${dict}` encodes the query string (`q=a b` becomes `q=a+b`). A list of tuples repeats a key.
|
|
69
|
+
- A URL or path containing `=` (`/search?q=x`) is read by Robot Framework as a named argument: the call fails with `missing 1 required positional argument: 'url'` after the warning `You might have an = symbol in url`. Pass the query as `params=`, or write `url=/search?q=x`.
|
|
70
|
+
- `headers=${dict}` on a session call is merged over the session headers for that request only.
|
|
71
|
+
|
|
72
|
+
## Timeouts, retries and redirects
|
|
73
|
+
|
|
74
|
+
- `timeout=` is in seconds; no timeout by default. Set it on `Create Session` or per request.
|
|
75
|
+
- `Create Session` retries failed connections: `max_retries=3`, `backoff_factor=0.1`, only for idempotent methods (`retry_method_list`). Set `retry_status_list=[502, 503]` to retry on those statuses as well, or `max_retries=0` to fail fast against a server that is down.
|
|
76
|
+
- `allow_redirects=${False}` stops following redirects (then assert `${resp.headers}[Location]`).
|
|
77
|
+
|
|
78
|
+
## TLS: verify and cert
|
|
79
|
+
|
|
80
|
+
- `Create Session` (and the digest, NTLM and client-cert variants) default to `verify=False`; sessionless calls verify by default. Use `verify=${True}` or `verify=${CURDIR}/ca.pem`.
|
|
81
|
+
- `disable_warnings=1` on the session hides urllib3's insecure-request warnings.
|
|
82
|
+
- Client certificates: `Create Client Cert Session api ${URL} client_certs=${certs}` where `${certs}` is `[cert.pem, key.pem]`; per request, `cert=`.
|
|
83
|
+
|
|
84
|
+
## Session-level options
|
|
85
|
+
|
|
86
|
+
`Create Session alias url headers= cookies= auth= timeout= proxies= verify= max_retries= backoff_factor= disable_warnings= retry_status_list= retry_method_list=`
|
|
87
|
+
|
|
88
|
+
- `Update Session api headers=${h} cookies=${c}` merges new values into an existing session (for example a token obtained after login).
|
|
89
|
+
- `Session Exists api` returns `${True}`/`${False}`.
|
|
90
|
+
- `Delete All Sessions` closes every session of the library, which is global: sessions otherwise outlive the suite that created them.
|
robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/response-validation.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Response Validation
|
|
2
|
+
|
|
3
|
+
Every request keyword returns a `requests.Response`. Read it with extended variable syntax.
|
|
4
|
+
|
|
5
|
+
| Expression | Value |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `${resp.status_code}` | status as an integer |
|
|
8
|
+
| `${resp.reason}` | status text (`OK`, `Not Found`) |
|
|
9
|
+
| `${resp.json()}` | parsed JSON (dict or list); raises if the body is not JSON |
|
|
10
|
+
| `${resp.text}` / `${resp.content}` | body as text / bytes |
|
|
11
|
+
| `${resp.headers}[content-type]` | header value; header names are case-insensitive |
|
|
12
|
+
| `${resp.cookies}[session_id]` | cookie value |
|
|
13
|
+
| `${resp.url}` | final URL after redirects |
|
|
14
|
+
| `${resp.elapsed.total_seconds()}` | duration in seconds |
|
|
15
|
+
|
|
16
|
+
## Status
|
|
17
|
+
|
|
18
|
+
The request keyword already checks the status (`expected_status`). After an `expected_status=anything` call:
|
|
19
|
+
|
|
20
|
+
```robotframework
|
|
21
|
+
Status Should Be 404 ${resp}
|
|
22
|
+
Status Should Be not found ${resp} msg=user 99 must not exist
|
|
23
|
+
Request Should Be Successful ${resp}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## JSON body
|
|
27
|
+
|
|
28
|
+
```robotframework
|
|
29
|
+
${body}= Set Variable ${resp.json()}
|
|
30
|
+
Should Be Equal ${body}[name] Alice
|
|
31
|
+
Should Be Equal ${body}[id] ${1}
|
|
32
|
+
Should Be Equal ${body}[profile][theme] dark
|
|
33
|
+
Length Should Be ${body}[items] 3
|
|
34
|
+
Should Be Equal ${body}[items][-1][id] ${3}
|
|
35
|
+
Dictionary Should Contain Key ${body} email
|
|
36
|
+
Should Be True $body['active'] is True
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Compare numbers with `${1}` (or `Should Be Equal As Integers`): `${body}[id]` is an `int`, and `Should Be Equal ${body}[id] 1` compares it with the string `1` and fails.
|
|
40
|
+
|
|
41
|
+
Lists of objects:
|
|
42
|
+
|
|
43
|
+
```robotframework
|
|
44
|
+
FOR ${user} IN @{resp.json()}
|
|
45
|
+
Dictionary Should Contain Key ${user} id
|
|
46
|
+
END
|
|
47
|
+
VAR ${names} ${{[u['name'] for u in $resp.json()]}}
|
|
48
|
+
List Should Contain Value ${names} Alice
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Headers and cookies
|
|
52
|
+
|
|
53
|
+
```robotframework
|
|
54
|
+
Should Start With ${resp.headers}[content-type] application/json
|
|
55
|
+
Dictionary Should Contain Key ${resp.headers} Location
|
|
56
|
+
Should Not Be Empty ${resp.cookies}[session_id]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Error bodies
|
|
60
|
+
|
|
61
|
+
```robotframework
|
|
62
|
+
${resp}= GET On Session api /users/invalid expected_status=400
|
|
63
|
+
Should Be Equal ${resp.json()}[error][code] INVALID_ID
|
|
64
|
+
```
|
robotframework_plugins/_assets/plugins/rf-api/skills/rf-requests/references/troubleshooting.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Find the failure message, then read the cause and fix. Environment problems (library not importable, wrong interpreter) belong to the rf-setup (plugin rf-core) skill.
|
|
4
|
+
|
|
5
|
+
- [HTTPError: 4xx/5xx Client/Server Error for url](#httperror-4xx5xx-clientserver-error-for-url)
|
|
6
|
+
- [Url: … Expected status: X != Y](#url--expected-status-x--y)
|
|
7
|
+
- [UnknownStatusError / InvalidExpectedStatus](#unknownstatuserror--invalidexpectedstatus)
|
|
8
|
+
- [Non-existing index or alias 'x'.](#non-existing-index-or-alias-x)
|
|
9
|
+
- [missing 1 required positional argument: 'url'](#missing-1-required-positional-argument-url)
|
|
10
|
+
- [TypeError: 'list' object is not callable](#typeerror-list-object-is-not-callable)
|
|
11
|
+
- [ConnectionError: Max retries exceeded](#connectionerror-max-retries-exceeded)
|
|
12
|
+
- [SSLError: CERTIFICATE_VERIFY_FAILED](#sslerror-certificate_verify_failed)
|
|
13
|
+
- [JSONDecodeError / Expecting value](#jsondecodeerror--expecting-value)
|
|
14
|
+
- [Assertion shows 200 (integer) != 200 (string)](#assertion-shows-200-integer--200-string)
|
|
15
|
+
- [400 or 415 from the server](#400-or-415-from-the-server)
|
|
16
|
+
- [See the request that was sent](#see-the-request-that-was-sent)
|
|
17
|
+
|
|
18
|
+
## HTTPError: 4xx/5xx Client/Server Error for url
|
|
19
|
+
|
|
20
|
+
Cause: `expected_status` was not set, so the keyword raised on an error status. Fix: in a negative test pass the status you expect (`expected_status=404`); in a positive test the server really failed — read the response body in the log.
|
|
21
|
+
|
|
22
|
+
## Url: … Expected status: X != Y
|
|
23
|
+
|
|
24
|
+
Cause: `expected_status=Y` was set and the server answered X. Fix: check the path (session base URL + path), method and body; the log shows the full request and response.
|
|
25
|
+
|
|
26
|
+
## UnknownStatusError / InvalidExpectedStatus
|
|
27
|
+
|
|
28
|
+
Cause: `expected_status` got a range such as `2xx` (`UnknownStatusError`) or an integer variable such as `${200}` (`InvalidExpectedStatus`). Fix: use a string code (`200`), a status name (`not found`), or `anything` followed by `Request Should Be Successful`.
|
|
29
|
+
|
|
30
|
+
## Non-existing index or alias 'x'.
|
|
31
|
+
|
|
32
|
+
Cause: `… On Session` used an alias that was never created, or `Delete All Sessions` ran earlier (for example in another suite's teardown). Fix: create the session in this suite's Suite Setup; check it with `Session Exists`.
|
|
33
|
+
|
|
34
|
+
## missing 1 required positional argument: 'url'
|
|
35
|
+
|
|
36
|
+
Usually preceded by the warning `You might have an = symbol in url`. Cause: the URL or path contains `=`, so Robot Framework read it as a named argument. Fix: move the query into `params=${dict}`, or write `url=/search?q=x`.
|
|
37
|
+
|
|
38
|
+
## TypeError: 'list' object is not callable
|
|
39
|
+
|
|
40
|
+
Cause: a sessionless keyword got `auth=${list}`; `requests` accepts only a tuple or an auth object. Fix: `${auth}= Evaluate ($USER, $PASSWORD)`, or put `auth=${list}` on `Create Session`.
|
|
41
|
+
|
|
42
|
+
## ConnectionError: Max retries exceeded
|
|
43
|
+
|
|
44
|
+
Cause: the server is not reachable at that host/port (wrong URL, server not started, proxy needed). Session calls retry first (`max_retries=3`), so the failure takes a moment and logs `Retrying (RetryAdapter…)` warnings. Fix: check the URL and that the server runs; behind a proxy pass `proxies=${dict}`; use `max_retries=0` on `Create Session` to fail at once.
|
|
45
|
+
|
|
46
|
+
## SSLError: CERTIFICATE_VERIFY_FAILED
|
|
47
|
+
|
|
48
|
+
Cause: verification is on (sessionless calls, or `verify=${True}`) and the server certificate is self-signed or from a private CA. Fix: `verify=${CURDIR}/ca.pem` with the CA bundle. Turning verification off is for local test servers only.
|
|
49
|
+
|
|
50
|
+
## JSONDecodeError / Expecting value
|
|
51
|
+
|
|
52
|
+
Cause: `${resp.json()}` on a body that is not JSON (HTML error page, empty 204 body). Fix: assert the status first, check `${resp.headers}[content-type]`, and log `${resp.text}`.
|
|
53
|
+
|
|
54
|
+
## Assertion shows 200 (integer) != 200 (string)
|
|
55
|
+
|
|
56
|
+
Cause: `${resp.status_code}` and JSON numbers are integers; a literal `200` in the test is a string. Fix: `${200}`, `Should Be Equal As Integers`, or `Status Should Be 200 ${resp}`.
|
|
57
|
+
|
|
58
|
+
## 400 or 415 from the server
|
|
59
|
+
|
|
60
|
+
Cause: the body went out in the wrong form — `data=${dict}` form-encodes, a hand-built JSON string lacks the `Content-Type` header, or numbers were sent as strings. Fix: `json=${dict}` with `${1}` / `${True}` values.
|
|
61
|
+
|
|
62
|
+
## See the request that was sent
|
|
63
|
+
|
|
64
|
+
Every request and response (method, URL, headers, body) is logged at INFO level in log.html. For wire-level output add `debug=1` to `Create Session`.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rf-restinstance
|
|
3
|
+
description: "Use first, before answering, for RF API tests with RESTinstance: JSON Schema. Not installs: rf-setup."
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: Requires Python 3.11+, robotframework>=7, robotcode[all]>=2.8 and RESTinstance in the project environment.
|
|
6
|
+
metadata:
|
|
7
|
+
author: manykarim
|
|
8
|
+
version: "1.0.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# RESTinstance Library Skill
|
|
12
|
+
|
|
13
|
+
RESTinstance (`Library REST`) sends JSON requests and asserts the last response with typed, path-based keywords that also build a JSON Schema of it.
|
|
14
|
+
Prefer it over rf-requests when the contract matters more than single values: schema files, learned schemas, OpenAPI specs, types and constraints.
|
|
15
|
+
For plain request/response checks, form posts, sessions or file uploads use rf-requests.
|
|
16
|
+
Verified against RESTinstance 1.8.0, Robot Framework 7.4.
|
|
17
|
+
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
Load this skill first, before exploring the project or answering from memory, when a Robot Framework API test uses RESTinstance (`Library REST`):
|
|
21
|
+
|
|
22
|
+
- typed assertions on the JSON response (Integer, String, Object, Array);
|
|
23
|
+
- JSON Schema validation, generating a schema from a response, OpenAPI/Swagger spec checks;
|
|
24
|
+
- a test fails on a type mismatch in the response body ("Expected integer, but got string"), or the user mentions RESTinstance or wants schema-driven API tests.
|
|
25
|
+
|
|
26
|
+
Not this skill: suites that import RequestsLibrary, or generic API tests with no library named, use `rf-requests`.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
Install into the project environment, with the tool the project already uses. Full steps and verification: `references/install.md`. For a new environment, Poetry and venv + pip forms, and troubleshooting, see `rf-setup` (plugin `rf-core`).
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uv add RESTinstance
|
|
34
|
+
```
|
|
35
|
+
Requires Python ≥ 3.11; the `SyntaxWarning` lines printed on import (from `flex`) are harmless.
|
|
36
|
+
|
|
37
|
+
## Import and defaults
|
|
38
|
+
|
|
39
|
+
Import with the base URL, send paths, and assert the status first on every request:
|
|
40
|
+
|
|
41
|
+
```robotframework
|
|
42
|
+
*** Settings ***
|
|
43
|
+
Library REST ${API_URL}
|
|
44
|
+
|
|
45
|
+
*** Test Cases ***
|
|
46
|
+
Get User
|
|
47
|
+
GET /users/1
|
|
48
|
+
Integer response status 200
|
|
49
|
+
Object response body required=["id", "name"]
|
|
50
|
+
String response body name Alice
|
|
51
|
+
Integer response body id minimum=1
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`${API_URL}` has to exist when the library is imported (`*** Variables ***` or `--variable`). A URL without scheme gets `http://`.
|
|
55
|
+
Escape hatch: when the base URL is only known at run time (a Suite Setup starts the server), import `REST` without a URL and send full URLs (`GET ${API_URL}/users/1`). Schema files and OpenAPI specs: see `references/schema-validation.md`.
|
|
56
|
+
|
|
57
|
+
## Which keyword for which situation
|
|
58
|
+
|
|
59
|
+
| Situation | Use | Details |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| Send a request | `GET` / `POST /users {"name": "Bo"}` / `PUT` / `PATCH` / `DELETE` | `references/json-handling.md` |
|
|
62
|
+
| Query string, per-request headers, timeout | `GET /users query={"page": "2"} headers={...} timeout=5` | — |
|
|
63
|
+
| Assert status | `Integer response status 200` (several values = any of them) | — |
|
|
64
|
+
| Assert a field's type, value or constraint | `String response body email format=email`, `Integer $[*].id minimum=1` | `references/json-handling.md` |
|
|
65
|
+
| Assert a field is absent or null | `Missing response body error`, `Null response body deleted_at` | — |
|
|
66
|
+
| Read a value for the next request | `${id}= Output response body id also_console=false` | `references/json-handling.md` |
|
|
67
|
+
| Validate against a schema file | `Expect Response Body ${CURDIR}/schemas/user.json` before the request | `references/schema-validation.md` |
|
|
68
|
+
| Learn a schema from a real response | `Output Schema response body file_path=...` | `references/schema-validation.md` |
|
|
69
|
+
| Stop schema validation | `Clear Expectations`, or `validate=false` on one request | `references/schema-validation.md` |
|
|
70
|
+
| Headers for all later requests | `Set Headers {"Authorization": "Bearer ${TOKEN}"}` | `references/authentication.md` |
|
|
71
|
+
| Basic/digest auth, client certificate | `Set Client Authentication`, `Set Client Cert` | `references/authentication.md` |
|
|
72
|
+
| Self-signed TLS in a test environment | `Set SSL Verify false` | `references/troubleshooting.md` |
|
|
73
|
+
| See what the response looks like | `Output response body`, `Output Schema` | — |
|
|
74
|
+
| Dump every request and response of the suite | `REST Instances ${OUTPUT DIR}/instances.json` | `references/troubleshooting.md` |
|
|
75
|
+
|
|
76
|
+
Paths start at the last instance: `response status`, `response body user name`, `response body items 0 id`, `response headers Content-Type`, or JSONPath rooted at the body (`$.items[*].id`).
|
|
77
|
+
|
|
78
|
+
## Agent workflow
|
|
79
|
+
|
|
80
|
+
1. Look up each keyword before you use it: `robotcode doc keyword REST "<Keyword>"`; find names with `robotcode doc keywords REST "<text>"`. Copy names and arguments exactly as robotcode shows them.
|
|
81
|
+
2. Write the test with the defaults above and the decision table.
|
|
82
|
+
3. Check the changed files statically: `robotcode analyze code <changed files>` (through the project environment, e.g. `uv run robotcode …`). Fix every error it reports.
|
|
83
|
+
4. Run them by longname: `robotcode robot -bl "<Suite.Sub.Test>"` (longnames from `robotcode discover tests`), or pass a whole directory. Don't pass a single `.robot` file: it skips the parent `__init__.robot`.
|
|
84
|
+
5. Read the results: `robotcode results show --failed`, then `robotcode results log -bl "<longname>"`. Don't parse output.xml by hand.
|
|
85
|
+
6. Fix the cause and go back to step 3 (static check). Stop when the tests pass or the failure is shown to be in the system under test, and say which.
|
|
86
|
+
|
|
87
|
+
## Gotchas
|
|
88
|
+
|
|
89
|
+
- **Error statuses pass silently** — `GET` returns normally on 404 or 500, because RESTinstance only records the response as a new instance. Assert `Integer response status 200` (or the expected error status) after every request.
|
|
90
|
+
- **Values after the path are exact allowed values, not patterns** — `String response body name Ali*` fails on `Alice`, and `/regex/` is compared literally, because extra arguments become the schema's `enum`. Write `String response body name pattern=^Ali`, or list every allowed value (`Integer response status 200 201`).
|
|
91
|
+
- **String arguments are decoded as JSON** — values and validation arguments get quotes added and go through `json.loads`, so `pattern=^\\d+` fails with `Input not is valid JSON`, and a single-quoted body (`{'a': 1}`) is sent as one JSON string. Write `pattern=^\\\\d+` (or `[0-9]`) and bodies as double-quoted JSON or a `&{dict}`.
|
|
92
|
+
- **A JSON Schema passed as a value is an enum too** — `Object response body {"type": "object"}` compares the body with that dict and fails. Use validation arguments (`Object response body required=["id"]`) or `Expect Response Body` with a schema.
|
|
93
|
+
- **Expectations leak into later tests** — `Expect Response Body`, `Expect Response` and `Expect Request` change the library instance, which lives for the whole suite (`ROBOT_LIBRARY_SCOPE = "TEST SUITE"`), so every later request in the suite is validated against them and fails the HTTP keyword itself. Set them in the test that needs them and end it with `Clear Expectations` (or use them on purpose in Suite Setup).
|
|
94
|
+
- **Headers and auth persist for the suite** — `Set Headers` and `Set Client Authentication` update the instance's request defaults, so a token set in one test is sent by all later tests. Use `headers=` on a single request, or reset with `Set Client Authentication ${NONE}`.
|
|
95
|
+
- **Type keywords return a list** — `${id}= Integer response body id` stores `[1]`, because the keyword returns every match of the path. Use `${id}= Output response body id also_console=false` for a single value (or `${id}[0]`).
|
|
96
|
+
- **`Output` and `Output Schema` print to the console** — `also_console=True` by default, which floods CI logs. Pass `also_console=false` once the paths are known.
|
|
97
|
+
|
|
98
|
+
## When to read the references
|
|
99
|
+
|
|
100
|
+
| Read | When |
|
|
101
|
+
|---|---|
|
|
102
|
+
| references/install.md | installing the library, its post-install steps, verifying the install, or a failed post-install step |
|
|
103
|
+
| references/migrate-from-requests.md | a suite moves from RequestsLibrary to RESTinstance: the keyword map |
|
|
104
|
+
| references/json-handling.md | Writing field paths, JSONPath, validation arguments, or chaining values between requests |
|
|
105
|
+
| references/schema-validation.md | Using schema files, learning schemas with `Output Schema`, expectations, or an OpenAPI `spec=` |
|
|
106
|
+
| references/authentication.md | Adding tokens, API keys, basic/digest auth or client certificates |
|
|
107
|
+
| references/troubleshooting.md | A request or assertion fails with an error you don't understand |
|
|
108
|
+
|
|
109
|
+
Examples in `assets/examples/`: `basic-rest.robot` (requests, paths, chaining, negative status), `schema-validation.robot` (learned schema, schema file, expectations).
|
|
110
|
+
|
|
111
|
+
## Companion Skills
|
|
112
|
+
|
|
113
|
+
| Need | Skill |
|
|
114
|
+
|------|-------|
|
|
115
|
+
| API tests with RequestsLibrary | `rf-requests` |
|
|
116
|
+
| Install Robot Framework or a library, fix the environment | `rf-setup` (plugin `rf-core`) |
|
|
117
|
+
| Write tests, suites, user keywords, resources and variables in Robot Framework syntax | `rf-language` (plugin `rf-core`) |
|
|
118
|
+
|
|
119
|
+
For running, discovering, keyword documentation, result analysis and debugging with the robotcode CLI, use the `robotcode` skill of the robotcode plugin (`robotcode@robotframework-agent-plugins`); the commands above work without it.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
*** Settings ***
|
|
2
|
+
Documentation RESTinstance basics: requests, status and field assertions, JSONPath,
|
|
3
|
+
... chaining values between requests and negative tests.
|
|
4
|
+
... Run: robot --variable API_URL:http://localhost:8000 basic-rest.robot
|
|
5
|
+
Library REST ${API_URL}
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
*** Variables ***
|
|
9
|
+
${API_URL} http://localhost:8000
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
*** Test Cases ***
|
|
13
|
+
Get One User
|
|
14
|
+
GET /users/1
|
|
15
|
+
Integer response status 200
|
|
16
|
+
Integer response body id 1
|
|
17
|
+
String response body name pattern=^[A-Z]
|
|
18
|
+
Boolean response body active
|
|
19
|
+
User Should Look Valid
|
|
20
|
+
|
|
21
|
+
List Users
|
|
22
|
+
GET /users query={"limit": "10"}
|
|
23
|
+
Integer response status 200
|
|
24
|
+
Array response body minItems=1
|
|
25
|
+
Integer $[*].id minimum=1
|
|
26
|
+
String $[*].email format=email
|
|
27
|
+
|
|
28
|
+
Create And Read Back
|
|
29
|
+
VAR &{new_user} name=Carol email=carol@example.com active=${True}
|
|
30
|
+
POST /users ${new_user}
|
|
31
|
+
Integer response status 201
|
|
32
|
+
${id}= Output response body id also_console=false
|
|
33
|
+
GET /users/${id}
|
|
34
|
+
Integer response status 200
|
|
35
|
+
String response body name Carol
|
|
36
|
+
|
|
37
|
+
Unknown User Returns 404
|
|
38
|
+
GET /users/99999
|
|
39
|
+
Integer response status 404
|
|
40
|
+
Missing response body id
|
|
41
|
+
|
|
42
|
+
Status Is One Of
|
|
43
|
+
DELETE /users/2
|
|
44
|
+
Integer response status 200 204 404
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
*** Keywords ***
|
|
48
|
+
User Should Look Valid
|
|
49
|
+
[Documentation] Reusable field checks for the last response.
|
|
50
|
+
Object response body required=["id", "name", "email"]
|
|
51
|
+
String response body email format=email
|