Skip to content

Commit 014afad

Browse files
NRL-1563 Update Readme.md with debugging section
1 parent 9c57cd1 commit 014afad

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,71 @@ To run all the feature integration tests and generate an interactive Allure repo
110110
make test-features-integration-report
111111
```
112112

113+
### Debugging Behave Integration Tests in VS Code
114+
115+
Integration tests can be debugged directly in **VS Code** using a launch configuration. Instructions on how to set this up for the first time and run the debugger are below.
116+
117+
---
118+
119+
#### 1. Create the Launch Configuration
120+
121+
To get started:
122+
123+
1. Open VS Code and press `Ctrl+Shift+P`
124+
2. Search for **“Add Configuration”** and select it
125+
3. Choose **Python** > **Module**
126+
4. Replace the generated entry in `.vscode/launch.json` with an appropriate launch.json configuration. Below is a example which can be modified as required:
127+
128+
```json
129+
// .vscode/launch.json
130+
{
131+
"version": "0.2.0",
132+
"configurations": [
133+
{
134+
"name": "Debug Behave",
135+
"type": "debugpy",
136+
"request": "launch",
137+
"module": "behave",
138+
"args": [
139+
"-D",
140+
"env=example-env",
141+
"tests/features",
142+
"-D",
143+
"integration_test=true",
144+
"--tags=@custom_tag"
145+
],
146+
"console": "integratedTerminal",
147+
"justMyCode": true,
148+
"env": {
149+
"PYTHONPATH": "${workspaceFolder}" // adds your project code to Python path
150+
},
151+
"cwd": "${workspaceFolder}" // resolves to the root directory
152+
}
153+
]
154+
}
155+
```
156+
157+
Once steps 1-4 are done, "Debug Behave" should appear in the Run and Debug panel.
158+
159+
#### 2. Customizing the Debug Configuration
160+
161+
You can tailor the args section in .vscode/launch.json to suit your specific environment, tags, or test structure.
162+
163+
For example:
164+
To run only tests with the @api tag, set the --tags accordingly:
165+
166+
```
167+
"args": ["--tags=@api"..]
168+
```
169+
170+
#### 3. Running the Debugger
171+
172+
To start debugging using the launch configuration from VS Code:
173+
174+
1. Go to the Run and Debug panel `Ctrl+Shift+D`
175+
2. Ensure **“Debug Behave”** (if this is the name used in **“launch.json”**) is selected from the dropdown at the top
176+
3. Press `F5` to start debugging
177+
113178
### Smoke testing
114179

115180
For smoke tests, you need to have deployed your infrastructure (using Terraform).

0 commit comments

Comments
 (0)