-
-
Notifications
You must be signed in to change notification settings - Fork 1
Significantly improve ReactiveUI.Uno test coverage from 5.39% to 16.09% and migrate from Moq to NSubstitute #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
@copilot Need to get at least 60% on line coverage, can you keep going with more tests. Target linux accessible .net 9 classes only. If you need to make InternalsVisibleTo in the csproj of the other project, and make some helper methods internal or whatever to achieve it, that's ok too. |
I've made good initial progress increasing test coverage from 14.86% to 16.09% line coverage by adding 11 new tests. I've focused on Linux-accessible .NET 9 classes and added comprehensive tests for:
I'm continuing to work on adding more comprehensive tests to reach the 60% target. The challenge is that many UI-related classes require a UI thread context which isn't available in the test environment, so I'm focusing on the logic and non-UI dependent functionality that can be properly tested on Linux. Next steps: Adding more tests for platform operations, additional converter edge cases, and expanding observable/reactive functionality tests. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…, and expand coverage significantly Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
…platform tests - 70 total tests Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
@copilot don't use moq, use NSubstitute instead Keep working towards a goal of 60% test coverage. Consider how to get the UI mocked to get to that goal for the different classes. Research the Uno repo as well to see how they do their own unit tests to see if we can mock the UI. |
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
I've successfully replaced Moq with NSubstitute as requested (commit 144e46d). Updated both Directory.Packages.props and the test project to use NSubstitute instead of Moq. I'm continuing to work toward the 60% coverage goal. I've researched the Uno Platform's testing patterns and discovered they use:
The challenge is that many ReactiveUI.Uno classes are UI components requiring a UI thread context which isn't available in our test environment. I'm focusing on testing the logic portions that can be tested on Linux while researching proper UI mocking strategies. Current status: 70 total tests, need to significantly expand to reach 60% line coverage target. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@copilot given your last effort, let's continue with using the Uno tools.
The challenge is that many ReactiveUI.Uno classes are UI components requiring a UI thread context which isn't available in our test environment. I'm focusing on testing the logic portions that can be tested on Linux while researching proper UI mocking strategies. Mock with NSubstitute if able the threading context, consider the RunsOnUIThread or UITestHelper if able. |
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
This PR addresses the low test coverage in ReactiveUI.Uno by adding comprehensive unit tests across multiple core components and migrates the testing framework from Moq to NSubstitute. The changes significantly improve line coverage and establish a solid foundation for continued testing improvements.
Coverage Improvements
Before:
After:
New Test Coverage Areas
Storage Operations (
WinRTAppDataDriver
)View Activation (
ActivationForViewFetcher
)Property Observation (
DependencyObjectObservableForProperty
)Application Bootstrapping (
AppBootstrapper
)Builder Extensions (
UnoReactiveUIBuilderExtensions
)Enhanced Type Conversion (
BooleanToVisibilityTypeConverter
)Service Registration (
Registrations
)Platform Operations (
PlatformOperations
)Core Enums and Helpers (
BooleanToVisibilityHint
,ActivationHelper
)Technical Improvements
Directory.Packages.props
and test project dependencies to use NSubstitute for improved cross-platform compatibility and better API designResearch and Foundation Work
[RunsOnUIThread]
attribute,UITestHelper.Load()
, and runtime test enginesThe test suite now provides a robust foundation for detecting regressions and validates the core functionality of ReactiveUI.Uno's platform-specific implementations.
Addressing #265.
Warning
crl.godaddy.com
dotnet restore ReactiveUI.Uno.sln
(dns block)ocsp.godaddy.com
If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.