Test Projects
Calculator has two test projects:| Project | Type | Framework | Description |
|---|---|---|---|
| CalculatorUnitTests | C++ | VSTest | Unit tests for CalcManager and CalcViewModel |
| CalculatorUITests | C# | Appium/WinAppDriver | End-to-end UI automation tests |
Unit Tests
Unit tests verify the core calculation logic and view models without requiring the full UI.Running Unit Tests in Visual Studio
Build the Test Project
Build the CalculatorUnitTests project:
- Right-click CalculatorUnitTests in Solution Explorer
- Select Build
Running Unit Tests from Command Line
Unit tests are run automatically in the CI pipeline for both x64 and x86 platforms on non-PR builds.
UI Tests
UI tests use Windows Application Driver (WinAppDriver) to automate the Calculator UI and verify end-to-end functionality.Prerequisites for UI Tests
Install WinAppDriver
Download and install Windows Application Driver.
Running UI Tests
UI Test Framework
The CalculatorUITestFramework project provides:- Page object models for Calculator screens
- Reusable test utilities and helpers
- WinAppDriver session management
- Common assertions and validations
Manual Tests
Before each release, the Calculator team runs extensive manual tests. These tests cover:Smoke Tests
- Math operations in Standard, Scientific, and Programmer calculators
- Converter functionality
- Always-on-Top mode behavior
- Memory and history features
Verification Tests
- Launch and basic app functionality
- All number input methods (mouse, keyboard, number pad)
- Arithmetic functions across all calculator modes
- Memory functions (MS, M+, M-, MR, MC)
- Trigonometric functions (Scientific mode)
- Logical operations (Programmer mode)
- Graphing mode features
- Date calculation
- Currency conversion
Accessibility Tests
- Narrator compatibility
- Keyboard navigation
- High contrast themes
- Screen reader support
Localization Tests
- Right-to-left (RTL) language support
- Localized strings and error messages
- Number format preferences
The complete manual test suite is available in ManualTests.md.
Test Coverage
Calculator aims for high test coverage:- Unit tests cover core calculation logic, view models, and utilities
- UI tests verify end-to-end user scenarios
- Manual tests ensure quality for features that are difficult to automate
Running Tests in CI
The GitHub Actions workflow automatically runs tests:- Push to
main,release/**, orfeature/**branches - Pull request to
main,release/**, orfeature/**branches - Manual workflow dispatch
Writing Tests
When contributing to Calculator, follow these guidelines:Include Tests with Changes
Your pull request should include tests whenever possible. Code should be structured to be unit testable independently of the UI.
Use Manual Tests When Needed
For features that cannot be easily automated, document test cases in ManualTests.md.
Follow Existing Patterns
Structure your tests similarly to existing tests in the codebase. Use the CalculatorUITestFramework for UI tests.
Troubleshooting Tests
UI Tests Fail to Start
WinAppDriver not runningUnit Tests Fail to Run
Test certificate not trustedNext Steps
Debugging
Learn debugging techniques and tips
Contributing
Start contributing to Calculator