Table of Contents
Testing Guide - Phase 1
๐งช How to Test the PR Review Utility
Prerequisites
- BitBucket account with at least one repository
- At least one Pull Request in that repository
- App Password configured
1๏ธโฃ Configuration Test
Test BitBucket Credentials
File: appsettings.json
Steps:
- Open
appsettings.json - Verify all fields are filled:
{ "BitBucket": { "BaseUrl": "https://api.bitbucket.org/2.0", "Workspace": "your-workspace", // โ Check this "Username": "your-username", // โ Check this "AppPassword": "ATBBxxx..." // โ Check this } }
Expected Result: No errors when starting the app
If it fails: Double-check your BitBucket Personal Settings
2๏ธโฃ Application Startup Test
Test .NET Core Application
Steps:
cd PRReviewUtility
dotnet restore
dotnet build
dotnet run
Expected Output:
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
If it fails:
- Check .NET 5 SDK is installed:
dotnet --version - Look for build errors in console
- Verify all NuGet packages restored
3๏ธโฃ UI Loading Test
Test Web Interface
Steps:
- Open browser
- Navigate to
http://localhost:5000 - Check page loads
Expected Result:
- โ Page displays "PR Review Utility" header
- โ Form with Repository and PR ID fields visible
- โ "Fetch Diff" button present
- โ No console errors (F12 โ Console)
Visual Checklist:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐น PR Review Utility โ โ Header visible?
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Repository: [________] โ โ Input field?
โ PR ID: [________] โ โ Input field?
โ [Fetch Diff] โ โ Button?
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
4๏ธโฃ API Endpoint Tests
Test REST API Directly
A. Get PR Details
curl http://localhost:5000/api/pr/YOUR-REPO/YOUR-PR-ID
Expected Response:
{
"id": 42,
"title": "Add new feature",
"author": {
"displayName": "John Doe"
},
"sourceBranch": "feature/new-feature",
"destinationBranch": "main"
}
B. Get Diff
curl http://localhost:5000/api/pr/YOUR-REPO/YOUR-PR-ID/diff
Expected Response:
{
"pullRequestId": 42,
"repository": "YOUR-REPO",
"filesChanged": 3,
"files": [
{
"fileName": "Program.cs",
"status": "modified",
"additions": 10,
"deletions": 5
}
]
}
C. Get Raw Diff
curl http://localhost:5000/api/pr/YOUR-REPO/YOUR-PR-ID/diff/raw
Expected Response: Plain text unified diff
5๏ธโฃ Full Workflow Test
Test Complete User Journey
Scenario: Review a pull request
Steps:
Enter PR Details
- Repository:
my-test-repo - PR ID:
1 - Click "Fetch Diff"
- Repository:
Verify Loading State
- โ Spinner appears
- โ "Fetching pull request data..." message
Check PR Details Section
- โ Title displayed
- โ Author name shown
- โ Branch info correct
- โ State badge visible (green/blue/red)
- โ Files changed count accurate
Check Files List
- โ All changed files listed
- โ Status badges (Added/Modified/Deleted)
- โ +/- statistics per file
- โ "View" button for each file
View Individual File Diff
- Click "View" on any file
- โ Diff content expands
- โ Code formatted properly
- โ Can collapse again
Test Raw Diff
- Click "Toggle Raw Diff"
- โ Raw diff section appears
- โ Full unified diff visible
- โ Can scroll through content
Test Copy to Clipboard
- Click "Copy to Clipboard" in raw diff
- โ Button changes to "Copied!"
- โ Paste in notepad to verify
Test Export
- Click "Export Diff as .txt"
- โ File downloads
- โ
Filename:
PR-{ID}-{REPO}-diff.txt - โ Open file - contains PR info + diff
6๏ธโฃ Error Handling Tests
Test Error Scenarios
A. Invalid Repository
Steps:
- Enter: Repository =
fake-repo-xyz - Enter: PR ID =
1 - Click "Fetch Diff"
Expected:
- โ Red error alert appears
- โ Message: "Failed to fetch pull request"
- โ No crash, UI still responsive
B. Invalid PR ID
Steps:
- Enter: Valid repository
- Enter: PR ID =
999999 - Click "Fetch Diff"
Expected:
- โ Error alert with helpful message
- โ Can try again with correct ID
C. Network Error
Steps:
- Disconnect internet
- Try to fetch PR
Expected:
- โ Error message displayed
- โ Application doesn't freeze
7๏ธโฃ Browser Compatibility Test
Test Across Browsers
| Browser | Version | Test Status | |---------|---------|-------------| | Chrome | Latest | โ / โ | | Firefox | Latest | โ / โ | | Edge | Latest | โ / โ | | Safari | Latest | โ / โ |
What to Check:
- Page layout renders correctly
- Forms work properly
- Buttons clickable
- Diff displays with formatting
- Export downloads file
8๏ธโฃ Performance Tests
Test Large PRs
Scenario: PR with 50+ files
Steps:
- Find a large PR in your repository
- Fetch it through the UI
- Observe performance
Expected:
- โ Loads within 5-10 seconds
- โ File list renders completely
- โ Can expand/collapse individual files
- โ Export works without timeout
9๏ธโฃ Edge Case Tests
A. Empty PR (No Changes)
Expected: Shows 0 files changed
B. PR with Binary Files
Expected: Binary files listed, no diff content
C. Deleted Files Only
Expected: Status shows "Deleted", deletions count shown
D. Very Long File Names
Expected: UI doesn't break, names wrap or truncate
๐ Security Tests
Test Credential Security
Check:
- โ App password not visible in browser
- โ API calls don't expose credentials
- โ appsettings.json in .gitignore
- โ No credentials in JavaScript files
View Network Tab (F12 โ Network):
- Look at API requests
- Verify Authorization header is not logged to console
โ Acceptance Criteria
Phase 1 passes testing if:
Functional Requirements
- [ ] Can configure BitBucket credentials
- [ ] Application starts without errors
- [ ] UI loads and displays correctly
- [ ] Can fetch PR details successfully
- [ ] Displays file list with statistics
- [ ] Can view individual file diffs
- [ ] Can view raw unified diff
- [ ] Can copy diff to clipboard
- [ ] Can export diff as .txt file
- [ ] Error handling works properly
Non-Functional Requirements
- [ ] Response time < 10 seconds for normal PRs
- [ ] UI is responsive (works on mobile)
- [ ] No JavaScript errors in console
- [ ] Works on Chrome, Firefox, Edge
- [ ] Code is clean and documented
๐ Bug Report Template
If you find issues:
**Bug**: [Short description]
**Steps to Reproduce**:
1.
2.
3.
**Expected Behavior**:
**Actual Behavior**:
**Environment**:
- OS:
- Browser:
- .NET Version:
**Screenshots**: [if applicable]
**Console Errors**: [F12 โ Console]
๐ Test Results Log
Document your testing:
Date: ___________
Tester: ___________
Test Cases:
[ ] Configuration Test - Pass / Fail
[ ] Application Startup - Pass / Fail
[ ] UI Loading - Pass / Fail
[ ] API Endpoints - Pass / Fail
[ ] Full Workflow - Pass / Fail
[ ] Error Handling - Pass / Fail
[ ] Browser Compatibility - Pass / Fail
Notes:
_________________________________
_________________________________
๐ฏ Next Steps After Testing
Once all tests pass:
- โ Document Issues: Note any bugs found
- โ Verify Fixes: Re-test after fixes
- โ Prepare for Phase 2: Ready for rule engine
- โ Deploy: Move to production if needed
๐ก Testing Tips
- Start Simple: Test with a small, simple PR first
- Use Different Repos: Test with various repository types
- Test Edge Cases: Empty PRs, huge PRs, binary files
- Check Logs: Look at console output for warnings
- Save Test Data: Keep example PR IDs for future testing
Happy Testing! ๐
Any issues? Check the README.md troubleshooting section.