Skip to content

Conversation

@weiyuanyue
Copy link
Contributor

@weiyuanyue weiyuanyue commented Dec 17, 2025

This PR establishes a comprehensive testing infrastructure for AI Dev Gallery by introducing three types of tests (unit, integration, and UI automation) with corresponding test frameworks and CI/CD integration.

Motivation

  • Quality Assurance: Ensure code changes don't break existing functionality
  • Regression Prevention: Catch UI and integration issues early in development
  • Maintainability: Provide safety net for refactoring and feature additions
  • Documentation: Tests serve as living documentation of expected behavior

Changes

Project Restructure

  • Renamed AIDevGallery.UnitTestsAIDevGallery.Tests to accommodate multiple test types
  • Updated solution and project references accordingly

Test Infrastructure

  1. FlaUITestBase: High-level UI testing framework

    • Simplified API for common UI interactions
    • Automatic screenshot capture on test completion
    • Clean resource management
  2. NativeUIA3TestBase: Low-level UI automation

    • Direct UIA3 COM interop for advanced scenarios
    • Detailed element inspection capabilities
    • Performance-critical test scenarios
  3. PerformanceCollector: Test execution metrics

    • CPU, memory, and disk usage monitoring
    • Performance regression detection

Test Categories

Unit Tests

  • AppUtilsTests: Validates utility functions (file size conversion, model metadata, etc.)
  • Auto-triggered on PRs for fast feedback

Integration Tests

  • ProjectGeneratorTests: End-to-end project generation workflow
  • Manual trigger (dependency issues being resolved)

UI Automation Tests 🖱️

  • SmokeTests: Quick sanity checks (app launch, window properties)
  • NavigationViewTests: Navigation menu interactions
  • MainWindowTests: Main window functionality
  • BasicInteractionTests: Common user workflows
  • NativeUIA3SmokeTests: Low-level automation validation
  • Manual trigger to avoid blocking PR pipeline

CI/CD Integration

Modified .github/workflows/build.yml:

  • Unit tests run automatically on every PR
  • Integration tests available via manual workflow dispatch
  • UI tests available via manual workflow dispatch

Original Workflow(Before)

graph TD
    A[Trigger: Push/PR] --> B[Build]
    B --> C[Generate MSIX]
    C --> D[Upload Artifact]
    D --> E[Complete]
    
    style A fill:#e1f5ff
    style B fill:#fff4e1
    style E fill:#e8f5e9
Loading

New Workflow(After)

graph TD
    A[Trigger Event] --> B{PR/Push?}
    
    B --> |Yes| C1[Run Unit Tests]
    C1 --> C1A[Generate Reports]
    C1A --> C2{Tests Pass?}
    C2 --> |Yes| C3[✓ Pass]
    C2 --> |No| C4[✗ Fail Fast]
    
    B --> |Yes|D1[Build]
    D1 --> D2[Generate MSIX & Upload Artifact]
    D2 --> D3[✓ Complete]
    
    F[Download MSIX<br/>Skip Build]
    
    A --> E{Manual Trigger<br/>All Tests?}
    E -->|Yes| G[Build App & Tests<br/>Independent Mode]
    
    F --> H[Deploy MSIX]
    G --> H
    
    H --> I[Run All Tests<br/>Unit+Integration+UI]
    I --> J[Generate Reports]
    J --> K[✓ Complete]
    
    style A fill:#e1f5ff
    style F fill:#c8e6c9
    style G fill:#fff9c4
    style I fill:#e8f5e9
    style K fill:#c8e6c9
    style C4 fill:#ffcdd2
Loading

Dependencies

  • Added FlaUI.UIA3 (v5.0.0) for UI automation framework

Known Limitations

  • Integration tests currently blocked by dependency resolution issues
  • UI tests require manual trigger to avoid CI/CD overhead
  • Performance baseline data still being collected

@weiyuanyue weiyuanyue changed the title Add UT & UIA infra [Test]Establish comprehensive testing infrastructure Dec 17, 2025
@weiyuanyue weiyuanyue changed the title [Test]Establish comprehensive testing infrastructure [Test]Establish Comprehensive Testing Infra Dec 17, 2025
@weiyuanyue weiyuanyue marked this pull request as ready for review December 17, 2025 11:31
@weiyuanyue weiyuanyue requested a review from a team as a code owner December 17, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants