From a09008662798504811400288e0a30fd98aec20f2 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sat, 6 May 2023 09:33:27 +0200 Subject: [PATCH 1/2] chore: add some missing implicit import for improved IDE integration --- resources/ApiUtils.resource | 1 + resources/AssertionUtils.resource | 5 +++++ resources/JsonUtils.resource | 1 + resources/MockServerUtils.resource | 1 + resources/NotificationUtils.resource | 2 +- resources/variables.py | 21 ++++++++------------- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index e4e35282..fe594ea9 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -5,6 +5,7 @@ Library REST ${url} Library RequestsLibrary Library OperatingSystem Library Collections +Library JSONLibrary *** Variables *** ${BATCH_CREATE_ENDPOINT_PATH} entityOperations/create diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 5a422f3b..5f60fae0 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -1,5 +1,10 @@ *** Settings *** Library ${EXECDIR}/libraries/assertionUtils.py +Library RequestsLibrary +Library Collections +Library JSONLibrary +Library REST +Library String *** Variable *** ${id_regex_expr}= root\\['id'\\] diff --git a/resources/JsonUtils.resource b/resources/JsonUtils.resource index 726f3bd3..0617a816 100644 --- a/resources/JsonUtils.resource +++ b/resources/JsonUtils.resource @@ -2,6 +2,7 @@ Library String Library DateTime Library JSONLibrary +Variables ${EXECDIR}/resources/variables.py *** Variable *** ${date_format}= %Y-%m-%dT%H:%M:%SZ diff --git a/resources/MockServerUtils.resource b/resources/MockServerUtils.resource index fa46cdd3..8290f67d 100644 --- a/resources/MockServerUtils.resource +++ b/resources/MockServerUtils.resource @@ -1,6 +1,7 @@ *** Settings *** Documentation Mock http server for subscriber Library HttpCtrl.Server +Variables ${EXECDIR}/resources/variables.py *** Keywords *** Start Context Source Mock Server diff --git a/resources/NotificationUtils.resource b/resources/NotificationUtils.resource index f12791b9..43af2820 100644 --- a/resources/NotificationUtils.resource +++ b/resources/NotificationUtils.resource @@ -5,13 +5,13 @@ Library Collections Library HttpCtrl.Server Library ${EXECDIR}/libraries/assertionUtils.py Library ${EXECDIR}/libraries/dateTimeUtils.py +Variables ${EXECDIR}/resources/variables.py *** Variable *** ${notification_type}= ContextSource Notfication ${date_format}= %Y-%m-%dT%H:%M:%SZ ${date_format_with_millis}= %Y-%m-%dT%H:%M:%S.%fZ - *** Keywords *** Start Local Server [Arguments] ${host}=${notification_server_host} ${port}=${notification_server_port} diff --git a/resources/variables.py b/resources/variables.py index f24138c4..f0c933b8 100644 --- a/resources/variables.py +++ b/resources/variables.py @@ -1,13 +1,8 @@ -def get_variables(arg=None): - variables = { - 'url': 'localhost:8080/ngsi-ld/v1', - 'ngsild_test_suite_context': 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld', - 'notification_server_host': '0.0.0.0', - 'notification_server_port': 8085, - 'send_notification_server_host': '0.0.0.0', - 'send_notification_server_port': 8085, - 'context_source_host': '0.0.0.0', - 'context_source_port': 8086 - } - return variables - \ No newline at end of file +url = 'localhost:8080/ngsi-ld/v1' +ngsild_test_suite_context = 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' +notification_server_host = '0.0.0.0' +notification_server_port = 8085 +send_notification_server_host = '0.0.0.0' +send_notification_server_port = 8085 +context_source_host = '0.0.0.0' +context_source_port = 8086 -- GitLab From 686b95ac8445847510d97e88f80e549e6c00d099 Mon Sep 17 00:00:00 2001 From: gpoujol Date: Wed, 31 May 2023 11:48:32 +0200 Subject: [PATCH 2/2] chore: add information about using/declare variable --- README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 45f30139..3c0126f6 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ * Confirm its installation with: -```$ python --version``` (Ubuntu) +```$ python3 --version``` (Ubuntu) ```$ python3 --version``` (MacOS) * At this point, you can launch Python3 interpreter: -```$ python``` (Ubuntu) +```$ python3``` (Ubuntu) ```$ python3``` (MacOS) @@ -28,6 +28,15 @@ * In case pip is not installed, [follow the official pip installation guide](https://pip.pypa.io/en/latest/installing/). +## Install IDE (PyCharm) + +* Install [PyCharm](https://www.jetbrains.com/fr-fr/pycharm/download) + +* Install [Robot Framework Language Server](https://plugins.jetbrains.com/plugin/16086-robot-framework-language-server) + +* Define as variable the path of the working directory: in Settings > Languages & Frameworks > Robot Framework (Project), +insert the following: `{"EXECDIR": "{path}/auth-test-suite"}` + ## Install IDE (VSCode) * Install [Visual Studio Code](https://code.visualstudio.com/docs/setup/linux) @@ -41,14 +50,16 @@ ## Configure the environment In the `resources/variables.py` file, configure the following: -* URL of the context broker under test (including the `ngsi-ld/v1` path, e.g., http://localhost:8080/ngsi-ld/v1) -* Notification server host and port (an address accessible from the context broker) +* `url` : It is the url of the context broker which is to be tested (including the `ngsi-ld/v1` path, e.g., http://localhost:8080/ngsi-ld/v1). +* `notification_server_host` and `notification_server_port` : This is the address and port used to create the local server to listen to notifications (the address must be accessible by the context broker). +* `send_notification_server_host` and `send_notification_server_port` : This is the address and port used when creating the subscription on the context broker (generally it is the same information as `notification_server_host` and `notification_server_port`). +* `context_source_host` and `context_source_port` : The address and port used for the context source. ## Install the project requirements Browse the base project root folder and execute the following command: -```$ python -m pip install -r requirements.txt``` (Ubuntu) +```$ python3 -m pip install -r requirements.txt``` (Ubuntu) ```$ python3 -m pip install -r requirements.txt``` (MacOS) -- GitLab