Skip to content

Commit 60aede9

Browse files
committed
testing: updated test report generation to use csv and not autosearh for results
Signed-off-by: IonutMuthi <[email protected]>
1 parent 085b664 commit 60aede9

File tree

5 files changed

+122
-308
lines changed

5 files changed

+122
-308
lines changed

tools/testing/README.md

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Scopy Testing Tools
22

3-
A comprehensive set of Python tools for managing Scopy's manual testing workflow. These tools automate test environment setup, result parsing, and Excel report generation for release testing processes.
3+
A comprehensive set of Python tools for managing Scopy's manual testing workflow. These tools automate test environment setup, result parsing, and CSV template generation for release testing processes.
44

55
## Quick Start
66

@@ -25,9 +25,9 @@ Edit the generated RST files in `testing_results/testing_results_v3.0.0/` and fi
2525
- **Comments:** Test execution notes
2626
- **Result:** PASS or FAIL
2727

28-
### 3. **Generate Excel Report**
28+
### 3. **CSV Template Auto-Generated**
29+
The CSV template is automatically created during step 1. You can also generate it manually:
2930
```bash
30-
# Parse completed test results and create Excel report
3131
python3 parseTestResults.py v3.0.0
3232
```
3333

@@ -74,9 +74,9 @@ python3 setup_test_environment.py v3.0.0 --new-since v2.5.0
7474
- Contains filtered RST files ready for manual testing
7575
- Preserves RST structure for documentation compilation
7676

77-
### `parseTestResults.py` - Excel Report Generation
77+
### `parseTestResults.py` - CSV Template Generation
7878

79-
**Purpose:** Parses completed test results and generates Excel reports with execution statistics.
79+
**Purpose:** Generates CSV templates from testing directories for manual test execution tracking.
8080

8181
**Basic Usage:**
8282
```bash
@@ -97,9 +97,9 @@ python3 parseTestResults.py v3.0.0 --output /path/to/custom_results.xlsx
9797
```
9898

9999
**Output:**
100-
- Creates/updates `testing_results/scopy_test_results.xlsx`
101-
- Each version gets its own worksheet
102-
- Columns: Test UID | Component | RBP | Result | Tested OS | Comments | File
100+
- Creates `testing_results/testing_results_{version}.csv`
101+
- Template with empty result fields for manual completion
102+
- Columns: Test UID | Component | RBP | Result | Tested OS | Comments | Tester | File
103103

104104
### `generateTestsTable.py` - Source Documentation Tracking
105105

@@ -153,24 +153,17 @@ cd testing_results/testing_results_v3.0.0/
153153
**Result:** PASS
154154
```
155155

156-
**3. Generate Report**
157-
```bash
158-
# Parse results and create Excel report
159-
python3 parseTestResults.py v3.0.0
160-
```
156+
**3. Track Test Execution**
157+
- Edit the auto-generated CSV template: `testing_results/testing_results_v3.0.0.csv`
158+
- Fill in Result, Tested OS, Comments, and Tester columns for each test
161159

162160
**4. Review Results**
163-
- Open `testing_results/scopy_test_results.xlsx`
164-
- Check "v3.0.0" worksheet for complete test execution summary
161+
- Open `testing_results/testing_results_v3.0.0.csv`
162+
- Use spreadsheet software for analysis and reporting
165163

166164

167165
## Requirements
168166

169-
### Dependencies
170-
```bash
171-
pip install openpyxl # For Excel file generation
172-
```
173-
174167
### Git Requirements
175168
- Git repository (required for `--new-since` functionality)
176169
- Proper git tags for version references
@@ -183,21 +176,22 @@ scopy/
183176
└── tools/testing/ # This toolset
184177
```
185178

186-
## Excel Report Format
179+
## CSV Template Format
187180

188181
### Columns
189182
- **Test UID** - Unique test identifier
190183
- **Component** - Test component (adc, dac, m2k, core, etc.)
191184
- **RBP** - Risk-based priority (P0, P1, P2, P3)
192-
- **Result** - Test outcome (PASSED, FAILED, SKIPPED)
193-
- **Tested OS** - Operating system used for testing
194-
- **Comments** - Test execution notes
185+
- **Result** - Test outcome (empty template field for PASSED/FAILED/SKIPPED)
186+
- **Tested OS** - Operating system used for testing (empty template field)
187+
- **Comments** - Test execution notes (empty template field)
188+
- **Tester** - Person executing the tests (empty template field)
195189
- **File** - Source RST filename
196190

197191
### Multiple Versions
198-
- Each version gets its own worksheet in the Excel file
192+
- Each version gets its own CSV file: `testing_results_{version}.csv`
199193
- Historical test data preserved across versions
200-
- Easy comparison between releases
194+
- Easy import into spreadsheet tools for analysis
201195

202196
## Troubleshooting
203197

tools/testing/file_filters.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
def _should_include_file(test_file, component_filter, new_uids):
1717
"""Determine if file should be included based on filters."""
18+
# Skip all index files - they're not needed for CSV workflow
19+
if 'index.rst' in test_file['relative_path']:
20+
return False
21+
1822
# Include files from specified components
1923
if test_file['component'] in component_filter:
2024
return True
@@ -23,12 +27,6 @@ def _should_include_file(test_file, component_filter, new_uids):
2327
if new_uids and any(test['uid'] in new_uids for test in test_file['tests']):
2428
return True
2529

26-
# Include only top-level index files, not component-specific ones
27-
if 'index.rst' in test_file['relative_path']:
28-
path_parts = test_file['relative_path'].split('/')
29-
# Include plugins/index.rst, general/index.rst but not plugins/m2k/index.rst
30-
return len(path_parts) == 2 and path_parts[1] == 'index.rst'
31-
3230
return False
3331

3432

tools/testing/file_operations.py

Lines changed: 3 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -12,66 +12,12 @@
1212

1313
import os
1414
import shutil
15-
import re
1615
from file_filters import filter_rst_content
1716

1817

19-
def get_copied_components(filtered_files):
20-
"""Track which components were actually copied."""
21-
copied_components = set()
22-
for tf in filtered_files:
23-
if tf['component'] not in ['other', 'general']:
24-
copied_components.add(tf['component'])
25-
return copied_components
26-
27-
28-
def extract_component_from_toctree_entry(entry):
29-
"""Extract component name from toctree entry."""
30-
# " adc/index" → "adc"
31-
# " core/hp_tests" → "core"
32-
entry = entry.strip()
33-
if '/' in entry:
34-
return entry.split('/')[0]
35-
return entry
36-
37-
38-
def filter_index_content(file_path, copied_components):
39-
"""Filter toctree entries in index files based on copied components."""
40-
41-
with open(file_path, 'r', encoding='utf-8') as f:
42-
content = f.read()
43-
44-
# Find toctree section
45-
toctree_pattern = r'(\.\. toctree::\n(?:\s+:[^\n]+\n)*\s*\n)(.*?)(\n\n|\.\.|$)'
46-
match = re.search(toctree_pattern, content, re.DOTALL)
47-
48-
if not match:
49-
return content # No toctree found
50-
51-
header = match.group(1)
52-
entries = match.group(2)
53-
footer = content[match.end():]
54-
55-
# Filter toctree entries
56-
filtered_entries = []
57-
for line in entries.split('\n'):
58-
if line.strip():
59-
# Extract component from entry like "adc/index" → "adc"
60-
component = extract_component_from_toctree_entry(line)
61-
if component in copied_components:
62-
filtered_entries.append(line)
63-
64-
# Reconstruct content
65-
before_toctree = content[:match.start()]
66-
new_entries = '\n'.join(filtered_entries)
67-
68-
return f"{before_toctree}{header}{new_entries}\n{footer}"
69-
70-
7118
def copy_files_unchanged(test_files, dest_dir, component_filter=None):
7219
"""Copy files without content modification."""
7320
copied_count = 0
74-
copied_components = get_copied_components(test_files) if component_filter else None
7521

7622
for test_file in test_files:
7723
src_path = test_file['file_path']
@@ -80,15 +26,8 @@ def copy_files_unchanged(test_files, dest_dir, component_filter=None):
8026
# Create destination directory
8127
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
8228

83-
# Filter index files when component filtering is active
84-
if component_filter and 'index.rst' in test_file['relative_path']:
85-
filtered_content = filter_index_content(src_path, copied_components)
86-
with open(dest_path, 'w', encoding='utf-8') as f:
87-
f.write(filtered_content)
88-
else:
89-
# Copy file unchanged
90-
shutil.copy2(src_path, dest_path)
91-
29+
# Copy file unchanged
30+
shutil.copy2(src_path, dest_path)
9231
copied_count += 1
9332

9433
return copied_count
@@ -101,7 +40,6 @@ def filter_by_rbp_content(test_files, rbp_filter, dest_dir, component_filter=Non
10140
return copy_files_unchanged(test_files, dest_dir, component_filter)
10241

10342
copied_count = 0
104-
copied_components = get_copied_components(test_files) if component_filter else None
10543

10644
# Filter active - parse and modify content
10745
for test_file in test_files:
@@ -114,12 +52,7 @@ def filter_by_rbp_content(test_files, rbp_filter, dest_dir, component_filter=Non
11452
filtered_content = filter_rst_content(test_file['file_path'], rbp_filter, new_uids)
11553
with open(dest_path, 'w', encoding='utf-8') as f:
11654
f.write(filtered_content)
117-
elif component_filter and 'index.rst' in test_file['relative_path']:
118-
# Filter index files when component filtering is active
119-
filtered_content = filter_index_content(test_file['file_path'], copied_components)
120-
with open(dest_path, 'w', encoding='utf-8') as f:
121-
f.write(filtered_content)
122-
else: # File has no tests (index, docs, etc.)
55+
else: # File has no tests (docs, etc.)
12356
shutil.copy2(test_file['file_path'], dest_path)
12457

12558
copied_count += 1

0 commit comments

Comments
 (0)