Skip to content

Commit c151bf2

Browse files
authored
add description for debugging the Web API and API tests (#51)
1 parent 08d24a5 commit c151bf2

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

docs/development/backend/setup.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,30 @@ However, running a server is useful if you
3434

3535
Running the server is simplified in the dev container by predefined tasks. You can run these tasks from the command palette (Ctrl+Shift+P or Cmd+Shift+P) by selecting "Tasks: Run Task" and then choosing one of the following:
3636
- "Serve Web API" - starts the Flask development server on port 5555 with debug logging enabled
37-
- "Start Celery worker" - starts a Celery worker to process background tasks.
37+
- "Start Celery worker" - starts a Celery worker to process background tasks.
38+
39+
40+
## Debugging
41+
42+
Debugging can sometimes be challenging, especially when trying to trace complex behavior or identify subtle issues. To make this easier, you can debug both a running API instance and individual test cases directly within Visual Studio Code.
43+
44+
### Debugging the Gramps Web API
45+
46+
To debug the running API:
47+
48+
1. Open Visual Studio Code and go to the **Run and Debug** view.
49+
2. Select the **"Web API"** configuration from the dropdown menu.
50+
3. Start debugging.
51+
4. When you send requests to the backend (either manually or through the Gramps Web GUI), the execution will pause at any breakpoints you have set in the code.
52+
This allows you to inspect variables, control flow, and other runtime details.
53+
54+
### Debugging Test Cases
55+
56+
To debug a specific test case:
57+
58+
1. Open the test file you want to debug (for example, `test_people.py`).
59+
2. In Visual Studio Code, open the **Run and Debug** view.
60+
3. Choose the **"Current Test File"** configuration.
61+
4. Start debugging — execution will stop at any breakpoints set within that test file.
62+
63+
This setup allows you to step through test logic, examine variable values, and better understand test failures or unexpected results.

0 commit comments

Comments
 (0)