Testing Guide
This guide covers both automated (Unity Test Runner) and manual testing for Lightweight Browser.
Automated Tests
Overview
| Suite | Framework | Tests | Scope |
| EditMode | NUnit [Test] | ~196 | Pure C# logic — no Play mode or native plugins needed |
| PlayMode | Unity [UnityTest] | ~25 | MonoBehaviour lifecycle, component wiring, coroutine flows |
Running Tests
- Open the Unity project
- Window → General → Test Runner
- Select the EditMode or PlayMode tab
- Click Run All
Command line:
Unity.exe -runTests -batchmode -projectPath . -testResults ./TestResults.xml -testPlatform EditMode
Basic Functionality
| # | Test | Verify |
| C1 | Enter Play mode | Demo page renders, no Console errors |
| C2 | URL bar → type URL → Enter | Page loads correctly |
| C3 | Click link on page | Navigates, URL bar updates |
| C4 | Back button | Returns to previous page |
| C5 | Forward button | Goes forward in history |
| C6 | Reload button | Page refreshes |
| C7 | Home button | Navigates to home URL |
| C8 | target="_blank" link | Navigates in-place, no new window |
| C9 | Back after _blank redirect | Returns to original page |
JS ↔ C# Bridge
| # | Test | Verify |
| C10 | unityBridge.send() from demo | C# receives event in Console |
| C11 | unityBridge.call() from demo | C# handler responds, JS gets result |
| C12 | C# → JS event push | JS listener fires on demo page |
| C13 | Bridge message during navigation | No exception |
Resize / Rotation
| # | Test | Verify |
| C14 | Resize window or rotate device | Webview re-renders at new resolution |
| C15 | Rapid resize/rotation | No crash, no stale frame |
| C16 | Text sharpness after resize | Native surface re-created (not stretched) |
| C17 | RawImage position after resize | Correct screen alignment |
| C18 | Normalized rect (0-1) | Resolves at any resolution |
| C19 | Rotate mid-page-load | Loading continues |
| C20 | History after resize | Back/Forward survive |
| # | Test | Verify |
| C21 | Click coordinates post-resize | Hits correct element |
| C22 | Keyboard post-resize | Text fields work |
| C23 | Scroll post-resize | Scrolling works |
Memory & Lifecycle
| # | Test | Verify |
| C24 | Repeated resize → Profiler | No texture leak |
| C25 | Destroy mid-resize | No crash |
| C26 | Bridge messages during rotation | Graceful handling |
Windows (WebView2)
| # | Test | Verify |
| W1 | Drag Game view to resize | Updates within ~150 ms |
| W2 | Minimize → Restore | No blank texture |
| W3 | OpenDevTools() | DevTools window opens |
| W4 | Mouse hover/cursor | Cursor changes on links |
macOS (WKWebView)
| # | Test | Verify |
| M1 | Drag window edge | Webview scales |
| M2 | Full-screen toggle | Adapts to resolution |
| M3 | OpenDevTools() | Web Inspector opens |
Linux (WebKitGTK)
| # | Test | Verify |
| L1 | Window resize | Webview tracks size |
| L2 | OpenDevTools() | Inspector opens |
| L3 | Wayland vs X11 | Both work |
Android
| # | Test | Verify |
| A1 | Portrait → Landscape | No black bars |
| A2 | Landscape → Portrait | No distortion |
| A3 | Split-screen / freeform | Resize works |
| A4 | Pause → Resume | Webview recovers |
| A5 | Soft keyboard | Layout adjusts |
| A6 | External schemes (tel:, mailto:) | No crash |
iOS (WKWebView)
| # | Test | Verify |
| I1 | Portrait → Landscape | Safe area respected |
| I2 | Landscape → Portrait | No distortion |
| I3 | Background → Foreground | Webview recovers |
| I4 | Safe area / notch | No under-notch render |
| I5 | Keyboard appears | Input field visible |