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:

  1. Open appsettings.json
  2. 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:

  1. Open browser
  2. Navigate to http://localhost:5000
  3. 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:

  1. Enter PR Details

    • Repository: my-test-repo
    • PR ID: 1
    • Click "Fetch Diff"
  2. Verify Loading State

    • โœ… Spinner appears
    • โœ… "Fetching pull request data..." message
  3. Check PR Details Section

    • โœ… Title displayed
    • โœ… Author name shown
    • โœ… Branch info correct
    • โœ… State badge visible (green/blue/red)
    • โœ… Files changed count accurate
  4. Check Files List

    • โœ… All changed files listed
    • โœ… Status badges (Added/Modified/Deleted)
    • โœ… +/- statistics per file
    • โœ… "View" button for each file
  5. View Individual File Diff

    • Click "View" on any file
    • โœ… Diff content expands
    • โœ… Code formatted properly
    • โœ… Can collapse again
  6. Test Raw Diff

    • Click "Toggle Raw Diff"
    • โœ… Raw diff section appears
    • โœ… Full unified diff visible
    • โœ… Can scroll through content
  7. Test Copy to Clipboard

    • Click "Copy to Clipboard" in raw diff
    • โœ… Button changes to "Copied!"
    • โœ… Paste in notepad to verify
  8. 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:

  1. Find a large PR in your repository
  2. Fetch it through the UI
  3. 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:

  1. โœ… Document Issues: Note any bugs found
  2. โœ… Verify Fixes: Re-test after fixes
  3. โœ… Prepare for Phase 2: Ready for rule engine
  4. โœ… Deploy: Move to production if needed

๐Ÿ’ก Testing Tips

  1. Start Simple: Test with a small, simple PR first
  2. Use Different Repos: Test with various repository types
  3. Test Edge Cases: Empty PRs, huge PRs, binary files
  4. Check Logs: Look at console output for warnings
  5. Save Test Data: Keep example PR IDs for future testing

Happy Testing! ๐ŸŽ‰

Any issues? Check the README.md troubleshooting section.