Notizen Annie Testing - SuQuoc/ft_transcendence GitHub Wiki
Testing with Hoppscotsch
Install/setup
- install the browser extension - https://docs.hoppscotch.io/documentation/features/interceptor#browser-extension
- for the moment we should browse https://localhost:8000 and accept the risks so that the connection is possible
Using variables in requests
- Contrary to Postman using placeholders like '<<$randomUserName>>' is not possible - we need to write a pre-request script (https://docs.hoppscotch.io/documentation/getting-started/rest/pre-request-scripts)
- Sometimes it is necessary to refresh the website so that the environment variables from the environment Transcendence are recognized. Variables should be called with '<<variable_name>>' without $ athe beginning (this is for global variables, not the environment variables).
Testing one complete collection
- To avoid errors because of missing TLS Certificate for our website we should set the following variable (we should only do it in dev environments): export NODE_TLS_REJECT_UNAUTHOIZED=0
- We can download the current version of the collections and the environment from Hoppscotsch Website
- A whole collection can only be tested in the CLI wtith: hopp test -e envfile.json collectionfile.json
As an alternative we can run the complete collection with a generated command line after having setup a token.
Testing with VS Code extension "REST Client"
When Hoppscotch is not working or to make quick tests we can use the "REST Client" extension from VS Code (file examples under tests/rest_api_extension_tests)
It is important to change the vscode extension setting 'rest-client.rememberCookiesForSubsequentRequest' to 'false' to avoid sending request with cookies and JWT that we created previously.
Testing with Django
[to be continued]
Testing with Playwright
[to be continued]
Testing with VSCode extension
{ "rest-client.environmentVariables": { "$shared": { "base_url": "https://localhost:8000", "username1": "[email protected]", "current_password1": "Pass1234!", "username2-1": "[email protected]", "username2-2": "[email protected]", "current_password2": "Pass1234!", "new_password2": "5678?Word", "username3": "[email protected]", "current_password3": "Annie1234!", "new_password3": "Pass1234!", "username4": "[email protected]", "current_password4": "Pass1234!", "new_password4": "4567?Word", "username5": "[email protected]", "displayname5": "ProCoder5", "current_password5": "Pass1234!", "new_password5": "4567!Word" } } }