├── .gitignore
├── README.md
├── Utilities
├── config_reader.py
└── read_csv_data.py
├── allure-report
├── app.js
├── data
│ ├── attachments
│ │ ├── 1c9f1d7b4bb8b31.txt
│ │ ├── 5ef4cef2385f8b5f.txt
│ │ ├── 692a0352f658f276.txt
│ │ └── bb249fc1f31eb7b2.txt
│ ├── behaviors.csv
│ ├── behaviors.json
│ ├── categories.csv
│ ├── categories.json
│ ├── packages.json
│ ├── suites.csv
│ ├── suites.json
│ ├── test-cases
│ │ ├── 2f254be68e3abb4a.json
│ │ ├── 2f404ca8efc12217.json
│ │ ├── 57084072a087eac6.json
│ │ └── e1fd4a61a311785c.json
│ └── timeline.json
├── export
│ ├── influxDbData.txt
│ ├── mail.html
│ └── prometheusData.txt
├── favicon.ico
├── history
│ ├── categories-trend.json
│ ├── duration-trend.json
│ ├── history-trend.json
│ ├── history.json
│ └── retry-trend.json
├── index.html
├── plugins
│ ├── behaviors
│ │ └── index.js
│ ├── packages
│ │ └── index.js
│ └── screen-diff
│ │ ├── index.js
│ │ └── styles.css
├── styles.css
└── widgets
│ ├── behaviors.json
│ ├── categories-trend.json
│ ├── categories.json
│ ├── duration-trend.json
│ ├── duration.json
│ ├── environment.json
│ ├── executors.json
│ ├── history-trend.json
│ ├── launch.json
│ ├── retry-trend.json
│ ├── severity.json
│ ├── status-chart.json
│ ├── suites.json
│ └── summary.json
├── allure-results
├── 00b14392-b5d8-4190-b50e-e2a1116428c1-container.json
├── 04cde29d-a0e3-4f6d-9e75-a96778d11282-result.json
├── 10ea48a3-71ce-4272-810f-e611ffb60465-container.json
├── 4e328a26-12cf-4010-8d7d-026e949c6f9a-result.json
├── 5e013d62-6f4d-4934-b49b-030884795e3f-container.json
├── 6b6e424f-822a-47bd-9dd8-1a13b1e39b09-container.json
├── 8eae396d-dab0-4ea7-b4b8-16321cc09cec-attachment.txt
├── 9ca259c6-3ec3-4595-a35c-243be489642c-result.json
├── a638e226-b71b-4008-949c-05ad1ec6b5fe-container.json
├── bfd6df18-fd2d-496f-bc42-ac6ff78af7e2-container.json
├── c47e4169-681a-4bc5-ac32-18f2b6bd3e54-container.json
├── d2fa8719-059d-4799-b078-34a35097220b-result.json
├── dab64727-1d0c-4f8c-8301-67eddd85160f-attachment.txt
├── dd09efa0-97a1-4550-b1e6-67f3a0b6ee2b-container.json
├── e10cc27f-080e-46c5-aff7-5ddd84263228-attachment.txt
└── ef3ec96e-d143-4676-8db0-c31b5dd972bb-attachment.txt
├── config.ini
├── requirements.txt
├── test_api_flow.py
├── test_create_task_put_request.py
├── test_create_user_post_request.py
├── test_data
└── gorest_post_rqst_data.csv
├── test_delete_task_delete_request.py
├── test_get_task_get_request.py
├── test_list_tasks_get_request.py
├── test_root_get_request.py
└── test_update_task_put_request.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # file: ~/.gitignore_global
2 | .DS_Store
3 | .idea
4 | .project-root
5 | .pytest_cache
6 | __pycache__
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PythonRestApiTesting
2 | Rest Api Testing using Requests Module in Python with PyTest
3 |
4 | To test rest-api -
5 | 1) Requests module
6 | 2) PyTest
7 | 3) Python
8 | 4) Allure report
9 | 5) Config.ini
10 | 6) Data Driven Testing
11 | 7) Csv Data
12 |
13 | # 1. Project Structure and Core Components
14 |
15 | - **Test Scripts (test_*.py)**: Python files containing the actual test cases using the pytest framework for test discovery and execution.
16 | - `test_delete_task_delete_request.py`: Tests the DELETE endpoint for tasks.
17 | - `test_update_task_put_request.py`: Tests the PUT endpoint for tasks.
18 | - `test_create_user_post_request.py`: Tests the POST, GET, and PUT endpoints for users.
19 |
20 | - **Utilities (Utilities directory)**: Contains helper functions and configurations used by the test scripts.
21 | - `config_reader.py`: Reads configuration values from a file (likely `config.ini`), centralizing configuration management.
22 | - `read_csv_data.py`: Used for data-driven testing by reading test data from a CSV file.
23 |
24 | - **Configuration (config.ini)**: Stores configuration settings, such as API endpoints, authentication details, and other environment-specific information.
25 |
26 | - **Test Data (*.csv)**: CSV files store test data for data-driven testing, e.g., multiple sets of user data for the CreateUser API.
27 |
28 | - **Allure Report**: Generated by Allure, the `allure-report` directory contains detailed information about test execution.
29 | - `index.html`: The main HTML file for the Allure report.
30 | - `widgets/`: Contains JSON files for various report widgets (e.g., categories, summary, behaviors, timelines, history).
31 | - `data/attachments/`: Stores attachments like request/response logs, screenshots, or other relevant data.
32 | - `data/suites.json`: Contains information about test suites and their results.
33 | - `data/behaviors.json`: Contains information about test behaviors.
34 | - `data/timeline.json`: Contains information about the test execution timeline.
35 | - `data/history/`: Contains historical test results.
36 |
37 | 
38 |
39 |
40 | # 2. Key Technologies and Concepts
41 |
42 | - **Python**: The programming language used for writing test scripts and utility functions.
43 | - **requests Library**: A Python library for making HTTP requests, used to send requests and receive responses from API endpoints.
44 | - **pytest Framework**: A Python testing framework that simplifies test discovery, execution, and reporting. It supports features like test fixtures, parametrization, and assertions.
45 | - **Allure Report**: A reporting framework that generates visually appealing and informative test reports, featuring test categorization, timelines, graphs, and attachments.
46 | - **Data-Driven Testing**: Testing technique where test data is stored in external files (e.g., CSV) and used to run the same test with different inputs.
47 | - **Configuration Management**: Storing configuration settings (like API endpoints) in files (`config.ini`) to make tests more maintainable and adaptable.
48 |
49 | 
50 |
51 |
52 | # 3. Breakdown of Key Files and Code Snippets
53 |
54 | - **`test_delete_task_delete_request.py`**:
55 | - Imports: `requests`, `config_reader`.
56 | - `ENDPOINT`: Reads the DELETE task endpoint URL from the configuration file.
57 | - `test_delete_task_rqst_validation_error()`: Sends a DELETE request with an invalid task ID and asserts a 404 status code and error message.
58 |
59 | - **`test_update_task_put_request.py`**:
60 | - Imports: `requests`, `config_reader`.
61 | - `ENDPOINT`: Reads the PUT task endpoint URL from the configuration file.
62 | - `test_update_task_rqst_validation_error()`: Sends a PUT request with an empty payload and asserts a 422 status code and validation error message.
63 |
64 | - **`test_create_user_post_request.py`**:
65 | - Imports: `random`, `pytest`, `requests`, `read_csv_data`.
66 | - `endpoint`: Defines the base URL for the user API.
67 | - `@pytest.mark.parametrize(...)`: Decorator that runs `test_post_rqst` multiple times with different data from a CSV file.
68 | - `test_post_rqst(name, email, gender, status)`: Sends a POST request to create a user and verifies the response.
69 | - `test_get_rqst()`: Sends a GET request to retrieve the created user.
70 | - `test_put_rqst()`: Sends a PUT request to update the created user.
71 |
72 | 
73 |
74 |
75 | # 4. Test Execution Flow
76 |
77 | - Tests are executed using `pytest`, which discovers and runs the test functions in `test_*.py` files.
78 | - The test functions use the `requests` library to send HTTP requests to API endpoints.
79 | - Assertions validate the responses.
80 | - Allure is integrated with pytest to capture test results and generate reports.
81 | - The Allure report can be generated using `allure serve allure-report` command.
82 |
83 | 
84 |
85 |
86 |
--------------------------------------------------------------------------------
/Utilities/config_reader.py:
--------------------------------------------------------------------------------
1 | from configparser import ConfigParser
2 |
3 | from from_root import from_root
4 |
5 | config_file_path = from_root('config.ini')
6 | def readConfig(section, key):
7 | config = ConfigParser()
8 | config.read(config_file_path)
9 | return config.get(section, key)
10 |
11 |
12 | #print(readConfig("endpoint", "url"))
13 | print("path: "+str(config_file_path))
14 |
--------------------------------------------------------------------------------
/Utilities/read_csv_data.py:
--------------------------------------------------------------------------------
1 | import csv
2 |
3 |
4 | # This method opens the .csv file in reading mode, skips the header row, adds all other lines to the list of test data values test_data one by one and returns the test data object.
5 | def read_test_data_from_csv():
6 | test_data = []
7 | with open("test_data/gorest_post_rqst_data.csv", newline="") as csvfile:
8 | data = csv.reader(csvfile, delimiter=",")
9 | next(data) # skip header row
10 | for row in data:
11 | test_data.append(row)
12 | return test_data
13 |
--------------------------------------------------------------------------------
/allure-report/data/attachments/1c9f1d7b4bb8b31.txt:
--------------------------------------------------------------------------------
1 | put rqst
2 | 200
3 | {'gender': 'female', 'status': 'inactive', 'id': 2859809, 'name': 'tester16', 'email': 'tester16@email.com'}
4 |
--------------------------------------------------------------------------------
/allure-report/data/attachments/5ef4cef2385f8b5f.txt:
--------------------------------------------------------------------------------
1 | get rqst
2 | 200
3 | {'id': 2859809, 'name': 'tester16', 'email': 'tester16@email.com', 'gender': 'male', 'status': 'active'}
4 |
--------------------------------------------------------------------------------
/allure-report/data/attachments/692a0352f658f276.txt:
--------------------------------------------------------------------------------
1 | post rqst
2 | tester15
3 | 201
4 | {'id': 2859808, 'name': 'tester15', 'email': 'tester15@email.com', 'gender': 'male', 'status': 'active'}
5 | 2859808
6 |
--------------------------------------------------------------------------------
/allure-report/data/attachments/bb249fc1f31eb7b2.txt:
--------------------------------------------------------------------------------
1 | post rqst
2 | tester16
3 | 201
4 | {'id': 2859809, 'name': 'tester16', 'email': 'tester16@email.com', 'gender': 'male', 'status': 'active'}
5 | 2859809
6 |
--------------------------------------------------------------------------------
/allure-report/data/behaviors.csv:
--------------------------------------------------------------------------------
1 | "Epic","Feature","Story","FAILED","BROKEN","PASSED","SKIPPED","UNKNOWN"
2 | "","","","0","0","4","0","0"
3 |
--------------------------------------------------------------------------------
/allure-report/data/behaviors.json:
--------------------------------------------------------------------------------
1 | {"uid":"b1a8273437954620fa374b796ffaacdd","name":"behaviors","children":[{"name":"test_post_rqst[tester15-tester15@email.com-male-active]","uid":"57084072a087eac6","parentUid":"b1a8273437954620fa374b796ffaacdd","status":"passed","time":{"start":1686646828691,"stop":1686646829744,"duration":1053},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":["'tester15@email.com'","'male'","'tester15'","'active'"],"tags":[]},{"name":"test_post_rqst[tester16-tester16@email.com-male-active]","uid":"2f404ca8efc12217","parentUid":"b1a8273437954620fa374b796ffaacdd","status":"passed","time":{"start":1686646829774,"stop":1686646830786,"duration":1012},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":["'tester16@email.com'","'male'","'tester16'","'active'"],"tags":[]},{"name":"test_get_rqst","uid":"2f254be68e3abb4a","parentUid":"b1a8273437954620fa374b796ffaacdd","status":"passed","time":{"start":1686646830798,"stop":1686646831716,"duration":918},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]},{"name":"test_put_rqst","uid":"e1fd4a61a311785c","parentUid":"b1a8273437954620fa374b796ffaacdd","status":"passed","time":{"start":1686646831738,"stop":1686646832446,"duration":708},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]}]}
--------------------------------------------------------------------------------
/allure-report/data/categories.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JapneetSachdeva1/PythonRestApiTesting/b9a23ffa54c41198e0fefb05e6aad0d9accbeb57/allure-report/data/categories.csv
--------------------------------------------------------------------------------
/allure-report/data/categories.json:
--------------------------------------------------------------------------------
1 | {"uid":"4b4757e66a1912dae1a509f688f20b0f","name":"categories","children":[]}
--------------------------------------------------------------------------------
/allure-report/data/packages.json:
--------------------------------------------------------------------------------
1 | {"uid":"83edc06c07f9ae9e47eb6dd1b683e4e2","name":"packages","children":[{"name":"test_create_user_post_request","children":[{"name":"test_post_rqst[tester15-tester15@email.com-male-active]","uid":"57084072a087eac6","parentUid":"2373c04a14b4e8e3a7981a614e14cd50","status":"passed","time":{"start":1686646828691,"stop":1686646829744,"duration":1053},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":["'tester15@email.com'","'male'","'tester15'","'active'"],"tags":[]},{"name":"test_post_rqst[tester16-tester16@email.com-male-active]","uid":"2f404ca8efc12217","parentUid":"2373c04a14b4e8e3a7981a614e14cd50","status":"passed","time":{"start":1686646829774,"stop":1686646830786,"duration":1012},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":["'tester16@email.com'","'male'","'tester16'","'active'"],"tags":[]},{"name":"test_get_rqst","uid":"2f254be68e3abb4a","parentUid":"2373c04a14b4e8e3a7981a614e14cd50","status":"passed","time":{"start":1686646830798,"stop":1686646831716,"duration":918},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]},{"name":"test_put_rqst","uid":"e1fd4a61a311785c","parentUid":"2373c04a14b4e8e3a7981a614e14cd50","status":"passed","time":{"start":1686646831738,"stop":1686646832446,"duration":708},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]}],"uid":"2373c04a14b4e8e3a7981a614e14cd50"}]}
--------------------------------------------------------------------------------
/allure-report/data/suites.csv:
--------------------------------------------------------------------------------
1 | "Status","Start Time","Stop Time","Duration in ms","Parent Suite","Suite","Sub Suite","Test Class","Test Method","Name","Description"
2 | "passed","Tue Jun 13 14:30:30 IST 2023","Tue Jun 13 14:30:31 IST 2023","918","","test_create_user_post_request","","","","test_get_rqst",""
3 | "passed","Tue Jun 13 14:30:31 IST 2023","Tue Jun 13 14:30:32 IST 2023","708","","test_create_user_post_request","","","","test_put_rqst",""
4 | "passed","Tue Jun 13 14:30:28 IST 2023","Tue Jun 13 14:30:29 IST 2023","1053","","test_create_user_post_request","","","","test_post_rqst[tester15-tester15@email.com-male-active]",""
5 | "passed","Tue Jun 13 14:30:29 IST 2023","Tue Jun 13 14:30:30 IST 2023","1012","","test_create_user_post_request","","","","test_post_rqst[tester16-tester16@email.com-male-active]",""
6 |
--------------------------------------------------------------------------------
/allure-report/data/suites.json:
--------------------------------------------------------------------------------
1 | {"uid":"98d3104e051c652961429bf95fa0b5d6","name":"suites","children":[{"name":"test_create_user_post_request","children":[{"name":"test_post_rqst[tester15-tester15@email.com-male-active]","uid":"57084072a087eac6","parentUid":"6da7822c0c3e08ce9656a653205b5ed5","status":"passed","time":{"start":1686646828691,"stop":1686646829744,"duration":1053},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":["'tester15@email.com'","'male'","'tester15'","'active'"],"tags":[]},{"name":"test_post_rqst[tester16-tester16@email.com-male-active]","uid":"2f404ca8efc12217","parentUid":"6da7822c0c3e08ce9656a653205b5ed5","status":"passed","time":{"start":1686646829774,"stop":1686646830786,"duration":1012},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":["'tester16@email.com'","'male'","'tester16'","'active'"],"tags":[]},{"name":"test_get_rqst","uid":"2f254be68e3abb4a","parentUid":"6da7822c0c3e08ce9656a653205b5ed5","status":"passed","time":{"start":1686646830798,"stop":1686646831716,"duration":918},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]},{"name":"test_put_rqst","uid":"e1fd4a61a311785c","parentUid":"6da7822c0c3e08ce9656a653205b5ed5","status":"passed","time":{"start":1686646831738,"stop":1686646832446,"duration":708},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]}],"uid":"6da7822c0c3e08ce9656a653205b5ed5"}]}
--------------------------------------------------------------------------------
/allure-report/data/test-cases/2f254be68e3abb4a.json:
--------------------------------------------------------------------------------
1 | {"uid":"2f254be68e3abb4a","name":"test_get_rqst","fullName":"test_create_user_post_request#test_get_rqst","historyId":"f63fa94d11fb395a4464458fb915c135","time":{"start":1686646830798,"stop":1686646831716,"duration":918},"status":"passed","flaky":false,"newFailed":false,"newBroken":false,"newPassed":false,"retriesCount":0,"retriesStatusChange":false,"beforeStages":[],"testStage":{"status":"passed","steps":[],"attachments":[{"uid":"5ef4cef2385f8b5f","name":"stdout","source":"5ef4cef2385f8b5f.txt","type":"text/plain","size":118}],"parameters":[],"attachmentsCount":1,"shouldDisplayMessage":false,"stepsCount":0,"hasContent":true},"afterStages":[],"labels":[{"name":"suite","value":"test_create_user_post_request"},{"name":"host","value":"JapneetS-LAP"},{"name":"thread","value":"7692-MainThread"},{"name":"framework","value":"pytest"},{"name":"language","value":"cpython3"},{"name":"package","value":"test_create_user_post_request"},{"name":"resultFormat","value":"allure2"}],"parameters":[],"links":[],"hidden":false,"retry":false,"extra":{"severity":"normal","retries":[],"categories":[],"tags":[]},"source":"2f254be68e3abb4a.json","parameterValues":[]}
--------------------------------------------------------------------------------
/allure-report/data/test-cases/2f404ca8efc12217.json:
--------------------------------------------------------------------------------
1 | {"uid":"2f404ca8efc12217","name":"test_post_rqst[tester16-tester16@email.com-male-active]","fullName":"test_create_user_post_request#test_post_rqst","historyId":"031f5288906fd8ff77545fbffc18631a","time":{"start":1686646829774,"stop":1686646830786,"duration":1012},"status":"passed","flaky":false,"newFailed":false,"newBroken":false,"newPassed":false,"retriesCount":0,"retriesStatusChange":false,"beforeStages":[],"testStage":{"status":"passed","steps":[],"attachments":[{"uid":"bb249fc1f31eb7b2","name":"stdout","source":"bb249fc1f31eb7b2.txt","type":"text/plain","size":136}],"parameters":[],"attachmentsCount":1,"shouldDisplayMessage":false,"stepsCount":0,"hasContent":true},"afterStages":[],"labels":[{"name":"suite","value":"test_create_user_post_request"},{"name":"host","value":"JapneetS-LAP"},{"name":"thread","value":"7692-MainThread"},{"name":"framework","value":"pytest"},{"name":"language","value":"cpython3"},{"name":"package","value":"test_create_user_post_request"},{"name":"resultFormat","value":"allure2"}],"parameters":[{"name":"email","value":"'tester16@email.com'"},{"name":"gender","value":"'male'"},{"name":"name","value":"'tester16'"},{"name":"status","value":"'active'"}],"links":[],"hidden":false,"retry":false,"extra":{"severity":"normal","retries":[],"categories":[],"tags":[]},"source":"2f404ca8efc12217.json","parameterValues":["'tester16@email.com'","'male'","'tester16'","'active'"]}
--------------------------------------------------------------------------------
/allure-report/data/test-cases/57084072a087eac6.json:
--------------------------------------------------------------------------------
1 | {"uid":"57084072a087eac6","name":"test_post_rqst[tester15-tester15@email.com-male-active]","fullName":"test_create_user_post_request#test_post_rqst","historyId":"fa3a610b208538f96b125ed8af2ed149","time":{"start":1686646828691,"stop":1686646829744,"duration":1053},"status":"passed","flaky":false,"newFailed":false,"newBroken":false,"newPassed":false,"retriesCount":0,"retriesStatusChange":false,"beforeStages":[],"testStage":{"status":"passed","steps":[],"attachments":[{"uid":"692a0352f658f276","name":"stdout","source":"692a0352f658f276.txt","type":"text/plain","size":136}],"parameters":[],"attachmentsCount":1,"shouldDisplayMessage":false,"stepsCount":0,"hasContent":true},"afterStages":[],"labels":[{"name":"suite","value":"test_create_user_post_request"},{"name":"host","value":"JapneetS-LAP"},{"name":"thread","value":"7692-MainThread"},{"name":"framework","value":"pytest"},{"name":"language","value":"cpython3"},{"name":"package","value":"test_create_user_post_request"},{"name":"resultFormat","value":"allure2"}],"parameters":[{"name":"email","value":"'tester15@email.com'"},{"name":"gender","value":"'male'"},{"name":"name","value":"'tester15'"},{"name":"status","value":"'active'"}],"links":[],"hidden":false,"retry":false,"extra":{"severity":"normal","retries":[],"categories":[],"tags":[]},"source":"57084072a087eac6.json","parameterValues":["'tester15@email.com'","'male'","'tester15'","'active'"]}
--------------------------------------------------------------------------------
/allure-report/data/test-cases/e1fd4a61a311785c.json:
--------------------------------------------------------------------------------
1 | {"uid":"e1fd4a61a311785c","name":"test_put_rqst","fullName":"test_create_user_post_request#test_put_rqst","historyId":"9430cebed48462233283f3f05ca2fd71","time":{"start":1686646831738,"stop":1686646832446,"duration":708},"status":"passed","flaky":false,"newFailed":false,"newBroken":false,"newPassed":false,"retriesCount":0,"retriesStatusChange":false,"beforeStages":[],"testStage":{"status":"passed","steps":[],"attachments":[{"uid":"1c9f1d7b4bb8b31","name":"stdout","source":"1c9f1d7b4bb8b31.txt","type":"text/plain","size":122}],"parameters":[],"attachmentsCount":1,"shouldDisplayMessage":false,"stepsCount":0,"hasContent":true},"afterStages":[],"labels":[{"name":"suite","value":"test_create_user_post_request"},{"name":"host","value":"JapneetS-LAP"},{"name":"thread","value":"7692-MainThread"},{"name":"framework","value":"pytest"},{"name":"language","value":"cpython3"},{"name":"package","value":"test_create_user_post_request"},{"name":"resultFormat","value":"allure2"}],"parameters":[],"links":[],"hidden":false,"retry":false,"extra":{"severity":"normal","retries":[],"categories":[],"tags":[]},"source":"e1fd4a61a311785c.json","parameterValues":[]}
--------------------------------------------------------------------------------
/allure-report/data/timeline.json:
--------------------------------------------------------------------------------
1 | {"uid":"ab17fc5a4eb3bca4b216b548c7f9fcbc","name":"timeline","children":[{"name":"JapneetS-LAP","children":[{"name":"7692-MainThread","children":[{"name":"test_post_rqst[tester15-tester15@email.com-male-active]","uid":"57084072a087eac6","parentUid":"ea4d82c31d87925204ade96cfb278a03","status":"passed","time":{"start":1686646828691,"stop":1686646829744,"duration":1053},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":["'tester15@email.com'","'male'","'tester15'","'active'"],"tags":[]},{"name":"test_put_rqst","uid":"e1fd4a61a311785c","parentUid":"ea4d82c31d87925204ade96cfb278a03","status":"passed","time":{"start":1686646831738,"stop":1686646832446,"duration":708},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]},{"name":"test_get_rqst","uid":"2f254be68e3abb4a","parentUid":"ea4d82c31d87925204ade96cfb278a03","status":"passed","time":{"start":1686646830798,"stop":1686646831716,"duration":918},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":[],"tags":[]},{"name":"test_post_rqst[tester16-tester16@email.com-male-active]","uid":"2f404ca8efc12217","parentUid":"ea4d82c31d87925204ade96cfb278a03","status":"passed","time":{"start":1686646829774,"stop":1686646830786,"duration":1012},"flaky":false,"newFailed":false,"newPassed":false,"newBroken":false,"retriesCount":0,"retriesStatusChange":false,"parameters":["'tester16@email.com'","'male'","'tester16'","'active'"],"tags":[]}],"uid":"ea4d82c31d87925204ade96cfb278a03"}],"uid":"d5f7aa81c4efa2945b8000156551fea5"}]}
--------------------------------------------------------------------------------
/allure-report/export/influxDbData.txt:
--------------------------------------------------------------------------------
1 | launch_status failed=0 1686646844000000000
2 | launch_status broken=0 1686646844000000000
3 | launch_status passed=4 1686646844000000000
4 | launch_status skipped=0 1686646844000000000
5 | launch_status unknown=0 1686646844000000000
6 | launch_time duration=3755 1686646844000000000
7 | launch_time min_duration=708 1686646844000000000
8 | launch_time max_duration=1053 1686646844000000000
9 | launch_time sum_duration=3691 1686646844000000000
10 | launch_retries retries=0 1686646844000000000
11 | launch_retries run=4 1686646844000000000
12 |
--------------------------------------------------------------------------------
/allure-report/export/mail.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Allure Report summary mail
6 |
7 |
8 | Mail body
9 |
10 |
11 |
--------------------------------------------------------------------------------
/allure-report/export/prometheusData.txt:
--------------------------------------------------------------------------------
1 | launch_status_failed 0
2 | launch_status_broken 0
3 | launch_status_passed 4
4 | launch_status_skipped 0
5 | launch_status_unknown 0
6 | launch_time_duration 3755
7 | launch_time_min_duration 708
8 | launch_time_max_duration 1053
9 | launch_time_sum_duration 3691
10 | launch_retries_retries 0
11 | launch_retries_run 4
12 |
--------------------------------------------------------------------------------
/allure-report/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JapneetSachdeva1/PythonRestApiTesting/b9a23ffa54c41198e0fefb05e6aad0d9accbeb57/allure-report/favicon.ico
--------------------------------------------------------------------------------
/allure-report/history/categories-trend.json:
--------------------------------------------------------------------------------
1 | [{"data":{}}]
--------------------------------------------------------------------------------
/allure-report/history/duration-trend.json:
--------------------------------------------------------------------------------
1 | [{"data":{"duration":3755}}]
--------------------------------------------------------------------------------
/allure-report/history/history-trend.json:
--------------------------------------------------------------------------------
1 | [{"data":{"failed":0,"broken":0,"skipped":0,"passed":4,"unknown":0,"total":4}}]
--------------------------------------------------------------------------------
/allure-report/history/history.json:
--------------------------------------------------------------------------------
1 | {"031f5288906fd8ff77545fbffc18631a":{"statistic":{"failed":0,"broken":0,"skipped":0,"passed":1,"unknown":0,"total":1},"items":[{"uid":"2f404ca8efc12217","status":"passed","time":{"start":1686646829774,"stop":1686646830786,"duration":1012}}]},"fa3a610b208538f96b125ed8af2ed149":{"statistic":{"failed":0,"broken":0,"skipped":0,"passed":1,"unknown":0,"total":1},"items":[{"uid":"57084072a087eac6","status":"passed","time":{"start":1686646828691,"stop":1686646829744,"duration":1053}}]},"f63fa94d11fb395a4464458fb915c135":{"statistic":{"failed":0,"broken":0,"skipped":0,"passed":1,"unknown":0,"total":1},"items":[{"uid":"2f254be68e3abb4a","status":"passed","time":{"start":1686646830798,"stop":1686646831716,"duration":918}}]},"9430cebed48462233283f3f05ca2fd71":{"statistic":{"failed":0,"broken":0,"skipped":0,"passed":1,"unknown":0,"total":1},"items":[{"uid":"e1fd4a61a311785c","status":"passed","time":{"start":1686646831738,"stop":1686646832446,"duration":708}}]}}
--------------------------------------------------------------------------------
/allure-report/history/retry-trend.json:
--------------------------------------------------------------------------------
1 | [{"data":{"run":4,"retry":0}}]
--------------------------------------------------------------------------------
/allure-report/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Allure Report
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/allure-report/plugins/behaviors/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | allure.api.addTranslation('en', {
4 | tab: {
5 | behaviors: {
6 | name: 'Behaviors'
7 | }
8 | },
9 | widget: {
10 | behaviors: {
11 | name: 'Features by stories',
12 | showAll: 'show all'
13 | }
14 | }
15 | });
16 |
17 | allure.api.addTranslation('ru', {
18 | tab: {
19 | behaviors: {
20 | name: 'Функциональность'
21 | }
22 | },
23 | widget: {
24 | behaviors: {
25 | name: 'Функциональность',
26 | showAll: 'показать все'
27 | }
28 | }
29 | });
30 |
31 | allure.api.addTranslation('zh', {
32 | tab: {
33 | behaviors: {
34 | name: '功能'
35 | }
36 | },
37 | widget: {
38 | behaviors: {
39 | name: '特性场景',
40 | showAll: '显示所有'
41 | }
42 | }
43 | });
44 |
45 | allure.api.addTranslation('de', {
46 | tab: {
47 | behaviors: {
48 | name: 'Verhalten'
49 | }
50 | },
51 | widget: {
52 | behaviors: {
53 | name: 'Features nach Stories',
54 | showAll: 'Zeige alle'
55 | }
56 | }
57 | });
58 |
59 | allure.api.addTranslation('nl', {
60 | tab: {
61 | behaviors: {
62 | name: 'Functionaliteit'
63 | }
64 | },
65 | widget: {
66 | behaviors: {
67 | name: 'Features en story’s',
68 | showAll: 'Toon alle'
69 | }
70 | }
71 | });
72 |
73 | allure.api.addTranslation('he', {
74 | tab: {
75 | behaviors: {
76 | name: 'התנהגויות'
77 | }
78 | },
79 | widget: {
80 | behaviors: {
81 | name: 'תכונות לפי סיפורי משתמש',
82 | showAll: 'הצג הכול'
83 | }
84 | }
85 | });
86 |
87 | allure.api.addTranslation('br', {
88 | tab: {
89 | behaviors: {
90 | name: 'Comportamentos'
91 | }
92 | },
93 | widget: {
94 | behaviors: {
95 | name: 'Funcionalidades por história',
96 | showAll: 'Mostrar tudo'
97 | }
98 | }
99 | });
100 |
101 | allure.api.addTranslation('ja', {
102 | tab: {
103 | behaviors: {
104 | name: '振る舞い'
105 | }
106 | },
107 | widget: {
108 | behaviors: {
109 | name: 'ストーリー別の機能',
110 | showAll: '全て表示'
111 | }
112 | }
113 | });
114 |
115 | allure.api.addTranslation('es', {
116 | tab: {
117 | behaviors: {
118 | name: 'Funcionalidades'
119 | }
120 | },
121 | widget: {
122 | behaviors: {
123 | name: 'Funcionalidades por Historias de Usuario',
124 | showAll: 'mostrar todo'
125 | }
126 | }
127 | });
128 |
129 | allure.api.addTranslation('kr', {
130 | tab: {
131 | behaviors: {
132 | name: '동작'
133 | }
134 | },
135 | widget: {
136 | behaviors: {
137 | name: '스토리별 기능',
138 | showAll: '전체 보기'
139 | }
140 | }
141 | });
142 |
143 | allure.api.addTranslation('fr', {
144 | tab: {
145 | behaviors: {
146 | name: 'Comportements'
147 | }
148 | },
149 | widget: {
150 | behaviors: {
151 | name: 'Thèmes par histoires',
152 | showAll: 'Montrer tout'
153 | }
154 | }
155 | });
156 |
157 | allure.api.addTranslation('pl', {
158 | tab: {
159 | behaviors: {
160 | name: 'Zachowania'
161 | }
162 | },
163 | widget: {
164 | behaviors: {
165 | name: 'Funkcje według historii',
166 | showAll: 'pokaż wszystko'
167 | }
168 | }
169 | });
170 |
171 | allure.api.addTranslation('az', {
172 | tab: {
173 | behaviors: {
174 | name: 'Davranışlar'
175 | }
176 | },
177 | widget: {
178 | behaviors: {
179 | name: 'Hekayələr üzrə xüsusiyyətlər',
180 | showAll: 'hamısını göstər'
181 | }
182 | }
183 | });
184 |
185 | allure.api.addTab('behaviors', {
186 | title: 'tab.behaviors.name', icon: 'fa fa-list',
187 | route: 'behaviors(/)(:testGroup)(/)(:testResult)(/)(:testResultTab)(/)',
188 | onEnter: (function (testGroup, testResult, testResultTab) {
189 | return new allure.components.TreeLayout({
190 | testGroup: testGroup,
191 | testResult: testResult,
192 | testResultTab: testResultTab,
193 | tabName: 'tab.behaviors.name',
194 | baseUrl: 'behaviors',
195 | url: 'data/behaviors.json',
196 | csvUrl: 'data/behaviors.csv'
197 | });
198 | })
199 | });
200 |
201 | allure.api.addWidget('widgets', 'behaviors', allure.components.WidgetStatusView.extend({
202 | rowTag: 'a',
203 | title: 'widget.behaviors.name',
204 | baseUrl: 'behaviors',
205 | showLinks: true
206 | }));
207 |
--------------------------------------------------------------------------------
/allure-report/plugins/packages/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | allure.api.addTranslation('en', {
4 | tab: {
5 | packages: {
6 | name: 'Packages'
7 | }
8 | }
9 | });
10 |
11 | allure.api.addTranslation('ru', {
12 | tab: {
13 | packages: {
14 | name: 'Пакеты'
15 | }
16 | }
17 | });
18 |
19 | allure.api.addTranslation('zh', {
20 | tab: {
21 | packages: {
22 | name: '包'
23 | }
24 | }
25 | });
26 |
27 | allure.api.addTranslation('de', {
28 | tab: {
29 | packages: {
30 | name: 'Pakete'
31 | }
32 | }
33 | });
34 |
35 | allure.api.addTranslation('nl', {
36 | tab: {
37 | packages: {
38 | name: 'Packages'
39 | }
40 | }
41 | });
42 |
43 | allure.api.addTranslation('he', {
44 | tab: {
45 | packages: {
46 | name: 'חבילות'
47 | }
48 | }
49 | });
50 |
51 | allure.api.addTranslation('br', {
52 | tab: {
53 | packages: {
54 | name: 'Pacotes'
55 | }
56 | }
57 | });
58 |
59 | allure.api.addTranslation('ja', {
60 | tab: {
61 | packages: {
62 | name: 'パッケージ'
63 | }
64 | }
65 | });
66 |
67 | allure.api.addTranslation('es', {
68 | tab: {
69 | packages: {
70 | name: 'Paquetes'
71 | }
72 | }
73 | });
74 |
75 | allure.api.addTranslation('kr', {
76 | tab: {
77 | packages: {
78 | name: '패키지'
79 | }
80 | }
81 | });
82 |
83 | allure.api.addTranslation('fr', {
84 | tab: {
85 | packages: {
86 | name: 'Paquets'
87 | }
88 | }
89 | });
90 |
91 | allure.api.addTranslation('pl', {
92 | tab: {
93 | packages: {
94 | name: 'Pakiety'
95 | }
96 | }
97 | });
98 |
99 | allure.api.addTranslation('az', {
100 | tab: {
101 | packages: {
102 | name: 'Paketlər'
103 | }
104 | }
105 | });
106 |
107 | allure.api.addTab('packages', {
108 | title: 'tab.packages.name', icon: 'fa fa-align-left',
109 | route: 'packages(/)(:testGroup)(/)(:testResult)(/)(:testResultTab)(/)',
110 | onEnter: (function (testGroup, testResult, testResultTab) {
111 | return new allure.components.TreeLayout({
112 | testGroup: testGroup,
113 | testResult: testResult,
114 | testResultTab: testResultTab,
115 | tabName: 'tab.packages.name',
116 | baseUrl: 'packages',
117 | url: 'data/packages.json'
118 | });
119 | })
120 | });
121 |
--------------------------------------------------------------------------------
/allure-report/plugins/screen-diff/index.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | var settings = allure.getPluginSettings('screen-diff', { diffType: 'diff' });
3 |
4 | function renderImage(src) {
5 | return (
6 | '' +
7 | '

' +
10 | '
'
11 | );
12 | }
13 |
14 | function findImage(data, name) {
15 | if (data.testStage && data.testStage.attachments) {
16 | var matchedImage = data.testStage.attachments.filter(function (attachment) {
17 | return attachment.name === name;
18 | })[0];
19 | if (matchedImage) {
20 | return 'data/attachments/' + matchedImage.source;
21 | }
22 | }
23 | return null;
24 | }
25 |
26 | function renderDiffContent(type, diffImage, actualImage, expectedImage) {
27 | if (type === 'diff') {
28 | if (diffImage) {
29 | return renderImage(diffImage);
30 | }
31 | }
32 | if (type === 'overlay' && expectedImage) {
33 | return (
34 | '' +
35 | '

' +
38 | '
' +
39 | '

' +
42 | '
' +
43 | '
'
44 | );
45 | }
46 | if (actualImage) {
47 | return renderImage(actualImage);
48 | }
49 | return 'No diff data provided';
50 | }
51 |
52 | var TestResultView = Backbone.Marionette.View.extend({
53 | regions: {
54 | subView: '.screen-diff-view',
55 | },
56 | template: function () {
57 | return '';
58 | },
59 | onRender: function () {
60 | var data = this.model.toJSON();
61 | var testType = data.labels.filter(function (label) {
62 | return label.name === 'testType';
63 | })[0];
64 | var diffImage = findImage(data, 'diff');
65 | var actualImage = findImage(data, 'actual');
66 | var expectedImage = findImage(data, 'expected');
67 | if (!testType || testType.value !== 'screenshotDiff') {
68 | return;
69 | }
70 | this.showChildView(
71 | 'subView',
72 | new ScreenDiffView({
73 | diffImage: diffImage,
74 | actualImage: actualImage,
75 | expectedImage: expectedImage,
76 | }),
77 | );
78 | },
79 | });
80 | var ErrorView = Backbone.Marionette.View.extend({
81 | templateContext: function () {
82 | return this.options;
83 | },
84 | template: function (data) {
85 | return '' + data.error + '
';
86 | },
87 | });
88 | var AttachmentView = Backbone.Marionette.View.extend({
89 | regions: {
90 | subView: '.screen-diff-view',
91 | },
92 | template: function () {
93 | return '';
94 | },
95 | onRender: function () {
96 | jQuery
97 | .getJSON(this.options.sourceUrl)
98 | .then(this.renderScreenDiffView.bind(this), this.renderErrorView.bind(this));
99 | },
100 | renderErrorView: function (error) {
101 | console.log(error);
102 | this.showChildView(
103 | 'subView',
104 | new ErrorView({
105 | error: error.statusText,
106 | }),
107 | );
108 | },
109 | renderScreenDiffView: function (data) {
110 | this.showChildView(
111 | 'subView',
112 | new ScreenDiffView({
113 | diffImage: data.diff,
114 | actualImage: data.actual,
115 | expectedImage: data.expected,
116 | }),
117 | );
118 | },
119 | });
120 |
121 | var ScreenDiffView = Backbone.Marionette.View.extend({
122 | className: 'pane__section',
123 | events: function () {
124 | return {
125 | ['click [name="screen-diff-type-' + this.cid + '"]']: 'onDiffTypeChange',
126 | 'mousemove .screen-diff__overlay': 'onOverlayMove',
127 | };
128 | },
129 | initialize: function (options) {
130 | this.diffImage = options.diffImage;
131 | this.actualImage = options.actualImage;
132 | this.expectedImage = options.expectedImage;
133 | this.radioName = 'screen-diff-type-' + this.cid;
134 | },
135 | templateContext: function () {
136 | return {
137 | diffType: settings.get('diffType'),
138 | diffImage: this.diffImage,
139 | actualImage: this.actualImage,
140 | expectedImage: this.expectedImage,
141 | radioName: this.radioName,
142 | };
143 | },
144 | template: function (data) {
145 | if (!data.diffImage && !data.actualImage && !data.expectedImage) {
146 | return '';
147 | }
148 |
149 | return (
150 | 'Screen Diff
' +
151 | ''
167 | );
168 | },
169 | adjustImageSize: function (event) {
170 | var overImage = this.$(event.target);
171 | overImage.width(overImage.width());
172 | },
173 | onRender: function () {
174 | const diffType = settings.get('diffType');
175 | this.$('[name="' + this.radioName + '"][value="' + diffType + '"]').prop(
176 | 'checked',
177 | true,
178 | );
179 | if (diffType === 'overlay') {
180 | this.$('.screen-diff__image-over img').on('load', this.adjustImageSize.bind(this));
181 | }
182 | },
183 | onOverlayMove: function (event) {
184 | var pageX = event.pageX;
185 | var containerScroll = this.$('.screen-diff__container').scrollLeft();
186 | var elementX = event.currentTarget.getBoundingClientRect().left;
187 | var delta = pageX - elementX + containerScroll;
188 | this.$('.screen-diff__image-over').width(delta);
189 | },
190 | onDiffTypeChange: function (event) {
191 | settings.save('diffType', event.target.value);
192 | this.render();
193 | },
194 | });
195 | allure.api.addTestResultBlock(TestResultView, { position: 'before' });
196 | allure.api.addAttachmentViewer('application/vnd.allure.image.diff', {
197 | View: AttachmentView,
198 | icon: 'fa fa-exchange',
199 | });
200 | })();
201 |
--------------------------------------------------------------------------------
/allure-report/plugins/screen-diff/styles.css:
--------------------------------------------------------------------------------
1 | .screen-diff__switchers {
2 | margin-bottom: 1em;
3 | }
4 |
5 | .screen-diff__switchers label + label {
6 | margin-left: 1em;
7 | }
8 |
9 | .screen-diff__overlay {
10 | position: relative;
11 | cursor: col-resize;
12 | }
13 |
14 | .screen-diff__container {
15 | overflow-x: auto;
16 | }
17 |
18 | .screen-diff__image-over {
19 | top: 0;
20 | left: 0;
21 | bottom: 0;
22 | background: #fff;
23 | position: absolute;
24 | overflow: hidden;
25 | box-shadow: 2px 0 1px -1px #aaa;
26 | }
27 |
28 | .screen-diff-error {
29 | color: #fd5a3e;
30 | }
31 |
--------------------------------------------------------------------------------
/allure-report/widgets/behaviors.json:
--------------------------------------------------------------------------------
1 | {"total":4,"items":[]}
--------------------------------------------------------------------------------
/allure-report/widgets/categories-trend.json:
--------------------------------------------------------------------------------
1 | [{"data":{}}]
--------------------------------------------------------------------------------
/allure-report/widgets/categories.json:
--------------------------------------------------------------------------------
1 | {"total":0,"items":[]}
--------------------------------------------------------------------------------
/allure-report/widgets/duration-trend.json:
--------------------------------------------------------------------------------
1 | [{"data":{"duration":3755}}]
--------------------------------------------------------------------------------
/allure-report/widgets/duration.json:
--------------------------------------------------------------------------------
1 | [{"uid":"2f254be68e3abb4a","name":"test_get_rqst","time":{"start":1686646830798,"stop":1686646831716,"duration":918},"status":"passed","severity":"normal"},{"uid":"e1fd4a61a311785c","name":"test_put_rqst","time":{"start":1686646831738,"stop":1686646832446,"duration":708},"status":"passed","severity":"normal"},{"uid":"57084072a087eac6","name":"test_post_rqst[tester15-tester15@email.com-male-active]","time":{"start":1686646828691,"stop":1686646829744,"duration":1053},"status":"passed","severity":"normal"},{"uid":"2f404ca8efc12217","name":"test_post_rqst[tester16-tester16@email.com-male-active]","time":{"start":1686646829774,"stop":1686646830786,"duration":1012},"status":"passed","severity":"normal"}]
--------------------------------------------------------------------------------
/allure-report/widgets/environment.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/allure-report/widgets/executors.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/allure-report/widgets/history-trend.json:
--------------------------------------------------------------------------------
1 | [{"data":{"failed":0,"broken":0,"skipped":0,"passed":4,"unknown":0,"total":4}}]
--------------------------------------------------------------------------------
/allure-report/widgets/launch.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/allure-report/widgets/retry-trend.json:
--------------------------------------------------------------------------------
1 | [{"data":{"run":4,"retry":0}}]
--------------------------------------------------------------------------------
/allure-report/widgets/severity.json:
--------------------------------------------------------------------------------
1 | [{"uid":"e1fd4a61a311785c","name":"test_put_rqst","time":{"start":1686646831738,"stop":1686646832446,"duration":708},"status":"passed","severity":"normal"},{"uid":"2f404ca8efc12217","name":"test_post_rqst[tester16-tester16@email.com-male-active]","time":{"start":1686646829774,"stop":1686646830786,"duration":1012},"status":"passed","severity":"normal"},{"uid":"2f254be68e3abb4a","name":"test_get_rqst","time":{"start":1686646830798,"stop":1686646831716,"duration":918},"status":"passed","severity":"normal"},{"uid":"57084072a087eac6","name":"test_post_rqst[tester15-tester15@email.com-male-active]","time":{"start":1686646828691,"stop":1686646829744,"duration":1053},"status":"passed","severity":"normal"}]
--------------------------------------------------------------------------------
/allure-report/widgets/status-chart.json:
--------------------------------------------------------------------------------
1 | [{"uid":"2f254be68e3abb4a","name":"test_get_rqst","time":{"start":1686646830798,"stop":1686646831716,"duration":918},"status":"passed","severity":"normal"},{"uid":"e1fd4a61a311785c","name":"test_put_rqst","time":{"start":1686646831738,"stop":1686646832446,"duration":708},"status":"passed","severity":"normal"},{"uid":"57084072a087eac6","name":"test_post_rqst[tester15-tester15@email.com-male-active]","time":{"start":1686646828691,"stop":1686646829744,"duration":1053},"status":"passed","severity":"normal"},{"uid":"2f404ca8efc12217","name":"test_post_rqst[tester16-tester16@email.com-male-active]","time":{"start":1686646829774,"stop":1686646830786,"duration":1012},"status":"passed","severity":"normal"}]
--------------------------------------------------------------------------------
/allure-report/widgets/suites.json:
--------------------------------------------------------------------------------
1 | {"total":1,"items":[{"uid":"6da7822c0c3e08ce9656a653205b5ed5","name":"test_create_user_post_request","statistic":{"failed":0,"broken":0,"skipped":0,"passed":4,"unknown":0,"total":4}}]}
--------------------------------------------------------------------------------
/allure-report/widgets/summary.json:
--------------------------------------------------------------------------------
1 | {"reportName":"Allure Report","testRuns":[],"statistic":{"failed":0,"broken":0,"skipped":0,"passed":4,"unknown":0,"total":4},"time":{"start":1686646828691,"stop":1686646832446,"duration":3755,"minDuration":708,"maxDuration":1053,"sumDuration":3691}}
--------------------------------------------------------------------------------
/allure-results/00b14392-b5d8-4190-b50e-e2a1116428c1-container.json:
--------------------------------------------------------------------------------
1 | {"uuid": "2b6a9533-6c6d-473f-8bba-62334ad1d2ea", "befores": [{"name": "gender", "status": "passed", "start": 1686646828691, "stop": 1686646828691}], "start": 1686646828691, "stop": 1686646829757}
--------------------------------------------------------------------------------
/allure-results/04cde29d-a0e3-4f6d-9e75-a96778d11282-result.json:
--------------------------------------------------------------------------------
1 | {"name": "test_post_rqst[tester15-tester15@email.com-male-active]", "status": "passed", "attachments": [{"name": "stdout", "source": "dab64727-1d0c-4f8c-8301-67eddd85160f-attachment.txt", "type": "text/plain"}], "parameters": [{"name": "name", "value": "'tester15'"}, {"name": "email", "value": "'tester15@email.com'"}, {"name": "gender", "value": "'male'"}, {"name": "status", "value": "'active'"}], "start": 1686646828691, "stop": 1686646829744, "uuid": "c007abbd-2029-4448-9969-2d05614e8707", "historyId": "fa3a610b208538f96b125ed8af2ed149", "testCaseId": "54f57c2d2a12dc4c8006db895b12900c", "fullName": "test_create_user_post_request#test_post_rqst", "labels": [{"name": "suite", "value": "test_create_user_post_request"}, {"name": "host", "value": "JapneetS-LAP"}, {"name": "thread", "value": "7692-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "test_create_user_post_request"}]}
--------------------------------------------------------------------------------
/allure-results/10ea48a3-71ce-4272-810f-e611ffb60465-container.json:
--------------------------------------------------------------------------------
1 | {"uuid": "ab53662f-4862-462b-b22c-b91de0ba1c83", "befores": [{"name": "status", "status": "passed", "start": 1686646828691, "stop": 1686646828691}], "start": 1686646828691, "stop": 1686646829744}
--------------------------------------------------------------------------------
/allure-results/4e328a26-12cf-4010-8d7d-026e949c6f9a-result.json:
--------------------------------------------------------------------------------
1 | {"name": "test_put_rqst", "status": "passed", "attachments": [{"name": "stdout", "source": "e10cc27f-080e-46c5-aff7-5ddd84263228-attachment.txt", "type": "text/plain"}], "start": 1686646831738, "stop": 1686646832446, "uuid": "a2304a73-736c-40d3-b48f-b5912b114561", "historyId": "9430cebed48462233283f3f05ca2fd71", "testCaseId": "9430cebed48462233283f3f05ca2fd71", "fullName": "test_create_user_post_request#test_put_rqst", "labels": [{"name": "suite", "value": "test_create_user_post_request"}, {"name": "host", "value": "JapneetS-LAP"}, {"name": "thread", "value": "7692-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "test_create_user_post_request"}]}
--------------------------------------------------------------------------------
/allure-results/5e013d62-6f4d-4934-b49b-030884795e3f-container.json:
--------------------------------------------------------------------------------
1 | {"uuid": "c7431e16-ba42-4537-9d4c-a5397d28229c", "befores": [{"name": "name", "status": "passed", "start": 1686646829774, "stop": 1686646829774}], "start": 1686646829774, "stop": 1686646830788}
--------------------------------------------------------------------------------
/allure-results/6b6e424f-822a-47bd-9dd8-1a13b1e39b09-container.json:
--------------------------------------------------------------------------------
1 | {"uuid": "6ca4882c-4896-48d4-b4ac-040ea5d2cdbd", "befores": [{"name": "status", "status": "passed", "start": 1686646829774, "stop": 1686646829774}], "start": 1686646829774, "stop": 1686646830786}
--------------------------------------------------------------------------------
/allure-results/8eae396d-dab0-4ea7-b4b8-16321cc09cec-attachment.txt:
--------------------------------------------------------------------------------
1 | post rqst
2 | tester16
3 | 201
4 | {'id': 2859809, 'name': 'tester16', 'email': 'tester16@email.com', 'gender': 'male', 'status': 'active'}
5 | 2859809
6 |
--------------------------------------------------------------------------------
/allure-results/9ca259c6-3ec3-4595-a35c-243be489642c-result.json:
--------------------------------------------------------------------------------
1 | {"name": "test_post_rqst[tester16-tester16@email.com-male-active]", "status": "passed", "attachments": [{"name": "stdout", "source": "8eae396d-dab0-4ea7-b4b8-16321cc09cec-attachment.txt", "type": "text/plain"}], "parameters": [{"name": "name", "value": "'tester16'"}, {"name": "email", "value": "'tester16@email.com'"}, {"name": "gender", "value": "'male'"}, {"name": "status", "value": "'active'"}], "start": 1686646829774, "stop": 1686646830786, "uuid": "75961ca7-8967-4357-b44d-8b8690a5e8f7", "historyId": "031f5288906fd8ff77545fbffc18631a", "testCaseId": "54f57c2d2a12dc4c8006db895b12900c", "fullName": "test_create_user_post_request#test_post_rqst", "labels": [{"name": "suite", "value": "test_create_user_post_request"}, {"name": "host", "value": "JapneetS-LAP"}, {"name": "thread", "value": "7692-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "test_create_user_post_request"}]}
--------------------------------------------------------------------------------
/allure-results/a638e226-b71b-4008-949c-05ad1ec6b5fe-container.json:
--------------------------------------------------------------------------------
1 | {"uuid": "32daa828-325e-429b-9a62-69f02384d3ce", "befores": [{"name": "email", "status": "passed", "start": 1686646828691, "stop": 1686646828691}], "start": 1686646828691, "stop": 1686646829768}
--------------------------------------------------------------------------------
/allure-results/bfd6df18-fd2d-496f-bc42-ac6ff78af7e2-container.json:
--------------------------------------------------------------------------------
1 | {"uuid": "8709fec6-7af3-4d78-84bf-26afd4964a7f", "befores": [{"name": "name", "status": "passed", "start": 1686646828691, "stop": 1686646828691}], "start": 1686646828691, "stop": 1686646829768}
--------------------------------------------------------------------------------
/allure-results/c47e4169-681a-4bc5-ac32-18f2b6bd3e54-container.json:
--------------------------------------------------------------------------------
1 | {"uuid": "00efdc5a-cd29-47b6-a566-7028fbabca87", "befores": [{"name": "email", "status": "passed", "start": 1686646829774, "stop": 1686646829774}], "start": 1686646829774, "stop": 1686646830788}
--------------------------------------------------------------------------------
/allure-results/d2fa8719-059d-4799-b078-34a35097220b-result.json:
--------------------------------------------------------------------------------
1 | {"name": "test_get_rqst", "status": "passed", "attachments": [{"name": "stdout", "source": "ef3ec96e-d143-4676-8db0-c31b5dd972bb-attachment.txt", "type": "text/plain"}], "start": 1686646830798, "stop": 1686646831716, "uuid": "ab69a9d0-9c6b-4384-ba95-16878c810266", "historyId": "f63fa94d11fb395a4464458fb915c135", "testCaseId": "f63fa94d11fb395a4464458fb915c135", "fullName": "test_create_user_post_request#test_get_rqst", "labels": [{"name": "suite", "value": "test_create_user_post_request"}, {"name": "host", "value": "JapneetS-LAP"}, {"name": "thread", "value": "7692-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "test_create_user_post_request"}]}
--------------------------------------------------------------------------------
/allure-results/dab64727-1d0c-4f8c-8301-67eddd85160f-attachment.txt:
--------------------------------------------------------------------------------
1 | post rqst
2 | tester15
3 | 201
4 | {'id': 2859808, 'name': 'tester15', 'email': 'tester15@email.com', 'gender': 'male', 'status': 'active'}
5 | 2859808
6 |
--------------------------------------------------------------------------------
/allure-results/dd09efa0-97a1-4550-b1e6-67f3a0b6ee2b-container.json:
--------------------------------------------------------------------------------
1 | {"uuid": "26454008-1588-4930-a321-bff31252ddea", "befores": [{"name": "gender", "status": "passed", "start": 1686646829774, "stop": 1686646829774}], "start": 1686646829774, "stop": 1686646830788}
--------------------------------------------------------------------------------
/allure-results/e10cc27f-080e-46c5-aff7-5ddd84263228-attachment.txt:
--------------------------------------------------------------------------------
1 | put rqst
2 | 200
3 | {'gender': 'female', 'status': 'inactive', 'id': 2859809, 'name': 'tester16', 'email': 'tester16@email.com'}
4 |
--------------------------------------------------------------------------------
/allure-results/ef3ec96e-d143-4676-8db0-c31b5dd972bb-attachment.txt:
--------------------------------------------------------------------------------
1 | get rqst
2 | 200
3 | {'id': 2859809, 'name': 'tester16', 'email': 'tester16@email.com', 'gender': 'male', 'status': 'active'}
4 |
--------------------------------------------------------------------------------
/config.ini:
--------------------------------------------------------------------------------
1 | [endpoint]
2 | url = https://todo.pixegami.io/
3 |
4 | [root]
5 | root_rqst_response = Hello World from Todo API
6 | content_type = application/json
7 |
8 | [create_task]
9 | url = https://todo.pixegami.io/create-task
10 |
11 | [get_task]
12 | url = https://todo.pixegami.io/get-task/
13 |
14 | [list_tasks]
15 | url = https://todo.pixegami.io/list-tasks/
16 |
17 | [update_task]
18 | url = https://todo.pixegami.io/update-task
19 |
20 | [delete_task]
21 | url = https://todo.pixegami.io/delete-task/
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JapneetSachdeva1/PythonRestApiTesting/b9a23ffa54c41198e0fefb05e6aad0d9accbeb57/requirements.txt
--------------------------------------------------------------------------------
/test_api_flow.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from Utilities import config_reader
3 |
4 |
5 | def create_task():
6 | endpoint = config_reader.readConfig("create_task", "url")
7 | global task_id
8 | payload = {
9 | "content": "test content 2",
10 | "user_id": "test_user 2",
11 | "is_done": False
12 | }
13 | response = requests.put(endpoint, json=payload)
14 | # print(response.json())
15 | data = response.json()
16 | print(data)
17 | task_id = data['task']['task_id']
18 |
19 |
20 | def get_task():
21 | endpoint = config_reader.readConfig("get_task", "url")
22 |
23 | response = requests.get(endpoint + f"{task_id}")
24 | print(response)
25 | print(response.json())
26 |
27 |
28 | def delete_task():
29 | endpoint = config_reader.readConfig("delete_task", "url")
30 | response = requests.delete(endpoint + f"{task_id}")
31 | print(response)
32 | print(response.json())
33 |
34 |
35 | def test_api_flow():
36 | print("create task")
37 | create_task()
38 | print("get task")
39 | get_task()
40 | print("delete task")
41 | delete_task()
42 |
--------------------------------------------------------------------------------
/test_create_task_put_request.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from Utilities import config_reader
3 |
4 | ENDPOINT = config_reader.readConfig("create_task", "url")
5 |
6 |
7 | def test_create_task_rqst():
8 | #put rqst
9 | payload = {
10 | "content": "my test content",
11 | "user_id": "test_user",
12 | "is_done": False
13 | }
14 |
15 | response = requests.put(ENDPOINT, json=payload)
16 | assert response.status_code == 200
17 | data = response.json()
18 | print(data)
19 | print(data['task']['user_id'])
20 | # task_id = data['task']['task_id']
21 | # # Check whether a task exits with above task id
22 | # endpoint = config_reader.readConfig("get_task", "url")
23 | # get_task_response = requests.get(endpoint+f"{task_id}")
24 | # print(get_task_response.content)
25 |
26 | # check whether user got updated
27 | assert data['task']['user_id'] == payload["user_id"]
28 | # check whether content got updated
29 | assert data['task']['content'] == payload['content']
30 | # check whether is_done set to false
31 | assert data['task']['is_done'] == payload['is_done']
--------------------------------------------------------------------------------
/test_create_user_post_request.py:
--------------------------------------------------------------------------------
1 | import random
2 |
3 | import pytest
4 | import requests
5 | from Utilities.read_csv_data import read_test_data_from_csv
6 |
7 | endpoint = "https://gorest.co.in/public/v2/users/"
8 |
9 |
10 | # testing web_app used = https://gorest.co.in/
11 |
12 | @pytest.mark.parametrize("name, email, gender, status", read_test_data_from_csv())
13 | def test_post_rqst(name, email, gender, status):
14 | # create user
15 | print("post rqst")
16 | print(name)
17 | payload = {"name": name, "email": email, "gender": gender, "status": status}
18 | headers = {"content-type": "application/json",
19 | "Authorization": "Bearer 9c000fb269972e5e6f5874289b44aee494f0b0aab72b3e643f0370aab328ed76"}
20 | response = requests.post(endpoint, json=payload, headers=headers)
21 | print(response.status_code)
22 | print(response.json())
23 | data = response.json()
24 | global id_user
25 | id_user = data['id']
26 | print(id_user)
27 |
28 |
29 | def test_get_rqst():
30 | # get user
31 | print("get rqst")
32 | headers = {"content-type": "application/json",
33 | "Authorization": "Bearer 9c000fb269972e5e6f5874289b44aee494f0b0aab72b3e643f0370aab328ed76"}
34 | response = requests.get(endpoint + f"{id_user}", headers=headers)
35 | print(response.status_code)
36 | print(response.json())
37 |
38 |
39 | def test_put_rqst():
40 | # update user
41 | print("put rqst")
42 | headers = {"content-type": "application/json",
43 | "Authorization": "Bearer 9c000fb269972e5e6f5874289b44aee494f0b0aab72b3e643f0370aab328ed76"}
44 | payload = {
45 | "gender": "female", "status": "inactive"
46 | }
47 | response = requests.put(endpoint + f"{id_user}", json=payload, headers=headers)
48 | print(response.status_code)
49 | print(response.json())
50 |
--------------------------------------------------------------------------------
/test_data/gorest_post_rqst_data.csv:
--------------------------------------------------------------------------------
1 | name, email, gender, status
2 | tester15,tester15@email.com,male,active
3 | tester16,tester16@email.com,male,active
4 |
--------------------------------------------------------------------------------
/test_delete_task_delete_request.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from Utilities import config_reader
3 |
4 | ENDPOINT = config_reader.readConfig("update_task", "url")
5 |
6 |
7 | def test_delete_task_rqst_validation_error():
8 | task_id = 'sd'
9 | response = requests.delete(ENDPOINT + f"{task_id}")
10 | data = response.json()
11 | # validate status code should be 404
12 | assert response.status_code == 404
13 | # validate detail key should have Not Found
14 | assert data['detail'] == 'Not Found'
15 |
--------------------------------------------------------------------------------
/test_get_task_get_request.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from Utilities import config_reader
3 |
4 | ENDPOINT = config_reader.readConfig("get_task", "url")
5 |
6 |
7 | def test_get_task_rqst():
8 | task__id = "task_b398460a88c041ab8089fb4f1d311bea"
9 | response = requests.get(ENDPOINT + f"{task__id}")
10 | data = response.json()
11 | # validate status code is 200
12 | assert response.status_code == 200
13 | # validate task_id received in response is same
14 | assert data['task_id'] == task__id
15 |
--------------------------------------------------------------------------------
/test_list_tasks_get_request.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from Utilities import config_reader
3 |
4 | ENDPOINT = config_reader.readConfig("list_tasks", "url")
5 |
6 |
7 | def test_get_tasks_rqst():
8 | user_id = "test_user"
9 | response = requests.get(ENDPOINT + f"{user_id}")
10 | print(response)
11 | print(response.json())
12 | data = response.json()
13 | # print(str(data['tasks'][0]['user_id']))
14 |
15 | # validate if response code is 200
16 | assert response.status_code == 200
17 | # validate if user_id is same in response received
18 | assert data['tasks'][0]['user_id'] == user_id
19 |
--------------------------------------------------------------------------------
/test_root_get_request.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from Utilities import config_reader
3 |
4 | ENDPOINT = config_reader.readConfig("endpoint", "url")
5 |
6 |
7 | def test_call_endpoint():
8 | response = requests.get(ENDPOINT)
9 | assert response.status_code == 200 # test status code
10 | all_headers = response.headers
11 | content_type = all_headers["Content-Type"]
12 | assert content_type == "application/json" # test content_type of response received
13 | data = response.json()
14 | response_msg = data["message"]
15 | assert response_msg == config_reader.readConfig("root", "root_rqst_response") # test response msg received
16 |
--------------------------------------------------------------------------------
/test_update_task_put_request.py:
--------------------------------------------------------------------------------
1 | import requests
2 | from Utilities import config_reader
3 |
4 | ENDPOINT = config_reader.readConfig("update_task", "url")
5 |
6 |
7 | def test_update_task_rqst_validation_error():
8 | payload = {
9 | "content": "",
10 | "user_id": "",
11 | "task_id": "",
12 | "is_done": ""
13 | }
14 | response = requests.put(ENDPOINT, json=payload)
15 | print(response)
16 | print(response.json())
17 | data = response.json()
18 |
19 | # validate status code is 422
20 | assert response.status_code == 422
21 | # validate msg should be: value could not be parsed to a boolean
22 | assert data['detail'][0]['msg'] == "value could not be parsed to a boolean"
23 |
24 |
25 |
--------------------------------------------------------------------------------