# VRCAuthProxy Testing Strategy This document outlines the comprehensive testing strategy for VRCAuthProxy, a proxy service for interacting with the VRChat API. ## Overview The testing strategy for VRCAuthProxy incorporates both unit tests and integration tests to ensure the reliability and robustness of the proxy service. The selected testing frameworks were chosen based on their active development status, community support, and compatibility with .NET 8.0. ## Test Project Structure The test project is organized into several directories: ``` Tests/ ├── Unit/ # Unit tests │ ├── ConfigTests.cs │ └── HttpClientCookieContainerTests.cs ├── Integration/ # Integration tests │ ├── VRChatAuthenticationTests.cs │ └── ProxyIntegrationTests.cs ├── Helpers/ # Test helpers and fixtures │ └── TestSetup.cs └── VRCAuthProxy.Tests.csproj ``` ## Selected Testing Frameworks The following frameworks were selected for their recent updates, robust feature sets, and compatibility with the VRCAuthProxy codebase: 1. **xUnit (v2.6.6)** - Modern test framework for .NET with excellent parallel test execution. 2. **Moq (v4.20.70)** - Popular mocking framework for isolating components in unit tests. 3. **FluentAssertions (v6.12.0)** - More readable assertions with excellent error messages. 4. **WireMock.NET (v1.5.44)** - HTTP mocking library for simulating the VRChat API. 5. **Microsoft.AspNetCore.Mvc.Testing (v8.0.3)** - Framework for testing ASP.NET Core applications without mocking the HTTP pipeline. 6. **coverlet.collector (v6.0.0)** - Code coverage tool for measuring test coverage. ## Testing Approach ### Unit Tests Unit tests focus on testing individual components in isolation: - Configuration loading and saving - Cookie container handling - Authentication flows ### Integration Tests Integration tests verify the interaction between components: - End-to-end proxy request handling - Authentication with the VRChat API - Rate limiting and account rotation - WebSocket proxying ### Mocking Strategy - The VRChat API is mocked using WireMock.NET to simulate various responses: - Authentication success/failure - TOTP verification - Rate limiting - Successful API responses ## Running Tests Execute the tests using the following command: ```bash dotnet test ``` For code coverage reports: ```bash dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info ``` ## Continuous Integration The test suite is designed to be run in CI/CD pipelines. Include the following in your GitHub workflow: ```yaml - name: Test run: dotnet test --no-restore --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info ``` ## VRChat API Integration The tests are designed to work with the VRChat API by: 1. Mocking the API responses to simulate real-world scenarios 2. Testing authentication flows including two-factor authentication 3. Verifying that the proxy correctly handles rate limiting 4. Ensuring proper WebSocket proxying ## Areas for Future Improvement 1. **Load testing** - Add tests to verify performance under high load 2. **Security testing** - Add tests to verify that authentication tokens are properly handled 3. **Failure recovery testing** - Enhance tests for VRChat API outages 4. **Cross-platform testing** - Verify functionality across different operating systems