Summary
The test case import functionality does not validate required fields before saving imported entries. Malformed JSON records can be stored in IndexedDB, leading to invalid test cases appearing in the UI and potential rendering issues.
Steps to reproduce
1.Open AlgoScope.
2.Navigate to Test Case Manager.
3.Create a JSON file with invalid entries:
[
{},
{
"name": "",
"algorithm": "",
"input": ""
}
]
4.Import the JSON file using the Import Test Cases feature.
5.Open the test case list.
6.Observe that invalid or empty test cases are imported and displayed.
Expected behavior
- Imported test cases should be validated before being saved.
- Invalid entries should be rejected with a user-friendly error message.
- Only valid test cases should be stored in IndexedDB.
Actual behavior
- Malformed test cases are imported without validation.
- Empty or incomplete records are stored in IndexedDB.
- Invalid entries appear in the Test Case Manager and may cause unexpected UI behavior.
Operating system
Any (Ubuntu 24.04, Arch Linux, Windows 11, macOS 14)
Browser
Chrome, Firefox, Safari, Edge
AlgoScope version
Current main branch version (see package.json)
Logs, screenshots, or terminal output
No console errors are displayed during import.
Additional context
The issue originates in src/lib/testCaseStore.js, where imported JSON entries are processed and stored without validating required fields such as name, algorithm, and input.
Suggested validation:
if (
!tc.name?.trim() ||
!tc.algorithm?.trim() ||
!tc.input?.trim()
) {
throw new Error("Invalid test case format");
}
Alternatively, invalid entries could be skipped and reported to the user after import completion.
Summary
The test case import functionality does not validate required fields before saving imported entries. Malformed JSON records can be stored in IndexedDB, leading to invalid test cases appearing in the UI and potential rendering issues.
Steps to reproduce
1.Open AlgoScope.
2.Navigate to Test Case Manager.
3.Create a JSON file with invalid entries:
[
{},
{
"name": "",
"algorithm": "",
"input": ""
}
]
4.Import the JSON file using the Import Test Cases feature.
5.Open the test case list.
6.Observe that invalid or empty test cases are imported and displayed.
Expected behavior
Actual behavior
Operating system
Any (Ubuntu 24.04, Arch Linux, Windows 11, macOS 14)
Browser
Chrome, Firefox, Safari, Edge
AlgoScope version
Current main branch version (see package.json)
Logs, screenshots, or terminal output
Additional context
The issue originates in src/lib/testCaseStore.js, where imported JSON entries are processed and stored without validating required fields such as name, algorithm, and input.
Suggested validation:
if (
!tc.name?.trim() ||
!tc.algorithm?.trim() ||
!tc.input?.trim()
) {
throw new Error("Invalid test case format");
}
Alternatively, invalid entries could be skipped and reported to the user after import completion.