This guide will help you test all the error handling improvements made to the PBI Manual Test Case Generator.
- Start the backend server:
npm start - Start the Angular dev server (if testing frontend):
ng serve - Have your browser console open (F12) for debugging
Scenario: Try to fetch a work item ID that doesn't exist
Steps:
- Enter a non-existent work item ID (e.g.,
999999999) - Enter your project name (e.g.,
Testwise) - Click "Fetch PBI"
Expected Error:
Work item 999999999 not found. This could mean: (1) The ticket doesn't exist, (2) You don't have permission to view it, or (3) It's in a different project than 'Testwise'.
Where to Look:
- Red error banner at the top of the page
- Console should show:
Error fetching work item 999999999:
Status: [ ] Pass [ ] Fail
Scenario: Try to fetch a work item that exists but in a different project
Steps:
- Enter a valid work item ID from project A (e.g.,
98067) - Enter a different project name (e.g.,
WrongProject) - Click "Fetch PBI"
Expected Error:
Work item 98067 not found. This could mean: (1) The ticket doesn't exist, (2) You don't have permission to view it, or (3) It's in a different project than 'WrongProject'.
Where to Look:
- Red error banner at the top of the page
Status: [ ] Pass [ ] Fail
Scenario: Try to fetch a work item you don't have permission to view
Steps:
- Enter a work item ID from a project you don't have access to
- Click "Fetch PBI"
Expected Error:
Unable to access work item [ID]. You may not have permission to view this item or it may not exist in the specified project.
Where to Look:
- Red error banner at the top of the page
- Console should show:
Work item [ID] has no fields - likely a permissions issue
Status: [ ] Pass [ ] Fail
Scenario: This is caught by frontend validation after fetching
Steps:
- If the backend returns a work item with empty fields, the frontend should catch it
Expected Error:
Retrieved work item has no fields. Please check your permissions for this item.
Where to Look:
- Red error banner at the top of the page
- Should prevent quality assessment from running
Status: [ ] Pass [ ] Fail
Scenario: Work item is incomplete
Steps:
- This would be rare, but if a work item has fields but is missing System.Title
Expected Error:
Work item is missing essential data. You may not have sufficient permissions to view this item.
Where to Look:
- Red error banner at the top of the page
Status: [ ] Pass [ ] Fail
Scenario: Try to assess quality with invalid data
Steps:
- This would trigger if somehow
assessPBIQuality()runs with bad data
Expected Error (in quality assessment card):
Cannot assess quality: work item has no fields
Where to Look:
- Red error message in the "PBI Quality Assessment" section
- Retry button should appear
Status: [ ] Pass [ ] Fail
Scenario: Try to generate test cases without fetching a PBI first
Steps:
- Refresh the page
- Manually trigger test generation (this shouldn't be possible in UI, but good to verify button is disabled)
Expected Error:
Please fetch a PBI first
Where to Look:
- Error should appear in the "analysis-options" section if validation fails
Status: [ ] Pass [ ] Fail
Scenario: Try to generate test cases with incomplete work item data
Steps:
- This is a safety check that should trigger if data becomes corrupted
Expected Error:
Work item data is incomplete. Please fetch a valid PBI with proper permissions.
Where to Look:
- Red error banner in the test case generation section with "Dismiss" button
Status: [ ] Pass [ ] Fail
Scenario: Bedrock API call fails (e.g., expired AWS credentials)
Steps:
- Make sure your AWS SSO session is expired: wait 8-12 hours or manually expire it
- Fetch a valid PBI
- Click "Generate Manual Test Cases"
Expected Error:
Error generating test cases: [specific error message from Bedrock]
Where to Look:
- Red error banner below the "Generate Manual Test Cases" button
- "Dismiss" button should appear
- Console should show detailed error
Status: [ ] Pass [ ] Fail
Scenario: Try to regenerate without providing feedback
Steps:
- Successfully generate test cases
- In the feedback section, leave the textarea empty
- Try to click "Regenerate with Feedback" (button should be disabled)
Expected Behavior:
- Button should remain disabled
- No API call should be made
Status: [ ] Pass [ ] Fail
Scenario: Regeneration fails due to API error
Steps:
- Successfully generate test cases
- Provide feedback in the textarea
- Trigger an API failure (e.g., expired credentials)
- Click "Regenerate with Feedback"
Expected Error:
Error generating test cases: [specific error message]
Where to Look:
- Red error banner in the feedback section with "Dismiss" button
- Error should be clearly visible
- Console should show detailed error
Status: [ ] Pass [ ] Fail
Scenario: Errors can be dismissed by user
Steps:
- Trigger any error scenario (e.g., 404)
- Click the "Dismiss" button on the error message
Expected Behavior:
- Error message should disappear
- UI should remain functional
- User can try again
Status: [ ] Pass [ ] Fail
Scenario: Errors persist until dismissed or cleared by success
Steps:
- Trigger an error (e.g., wrong work item ID)
- Note the error message
- Don't dismiss it
- The error should remain visible
Expected Behavior:
- Error should stay visible
- Error should not disappear automatically
- Error should clear when a successful operation completes
Status: [ ] Pass [ ] Fail
Scenario: Errors appear with smooth animation
Steps:
- Trigger any error
- Watch for the fade-in animation
Expected Behavior:
- Error should fade in smoothly (0.3s animation)
- Should slide down slightly as it appears
- Should be noticeable but not jarring
Status: [ ] Pass [ ] Fail
Test:
curl http://localhost:3000/api/workitem/999999999?project=TestwiseExpected Response:
{
"success": false,
"error": "Work item 999999999 not found. This could mean: (1) The ticket doesn't exist, (2) You don't have permission to view it, or (3) It's in a different project than 'Testwise'.",
"validationError": true
}Status: [ ] Pass [ ] Fail
Test: Try to fetch a work item that returns empty fields
Expected Response:
{
"success": false,
"error": "Unable to access work item [ID]. You may not have permission to view this item or it may not exist in the specified project.",
"validationError": true
}Status: [ ] Pass [ ] Fail
Test: Simulate unauthorized access (invalid PAT token)
Steps:
- Temporarily change
AZURE_TOKENin.envto an invalid value - Restart server
- Try to fetch any work item
Expected Response:
{
"success": false,
"error": "Access denied for work item [ID]. Please check your Azure DevOps permissions and PAT token.",
"validationError": true
}Status: [ ] Pass [ ] Fail
Scenario: All errors should log details to console
Steps:
- Trigger various error scenarios
- Check browser console for detailed logs
Expected Logs:
Error fetching work item [ID]:Test case generation failed:with result objectTest case generation error:with error object- Console.error calls for all failures
Status: [ ] Pass [ ] Fail
Total Tests: 18 Passed: ___ Failed: ___
Document any issues or unexpected behavior here:
Check:
- Is
errorvariable being set correctly? - Is the
*ngIf="error && !loading"condition correct? - Check browser console for errors
Check:
- Verify
finallyblock isn't clearing errors - Check if
this.error = ''is being called too early
Check:
- Verify error is being cleared on success (
this.error = '') - Check if error messages are properly scoped to sections
Check:
- Verify click handler:
(click)="error = ''" - Check if button is properly styled and visible