Skip to content

Enhance test coverage#18

Merged
3rikF merged 17 commits intomainfrom
enhance_test_coverage
Jul 18, 2025
Merged

Enhance test coverage#18
3rikF merged 17 commits intomainfrom
enhance_test_coverage

Conversation

@3rikF
Copy link
Copy Markdown
Owner

@3rikF 3rikF commented Jul 18, 2025

No description provided.

3rikF added 12 commits July 18, 2025 23:39
Added new `Console` property .
Simplified logic.
Updated `WithDebugMode` (this will be renamed)
… and `TestConsoleTests.cs` to validate the behavior of the `ConsoleProgressBar` class and its interaction with `ConsoleTest` and `ConsoleReal`.
Added specific tests for `ConsoleInterceptor`.
Simplified code by removing untestable/unreachable code-paths.
…ts.cs` to validate the behavior of the `ConsoleProgressHandler` across various scenarios.

New tests have been added for handling empty collections, queryable collections, and enumerator variants.
@3rikF 3rikF requested a review from Copilot July 18, 2025 23:32
@3rikF 3rikF self-assigned this Jul 18, 2025
@3rikF 3rikF added the test The issue contains changes to the tests. label Jul 18, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances test coverage for the console progress bar library by adding comprehensive tests for new console abstraction interfaces and improving testability through dependency injection patterns.

  • Introduces console abstraction layer with IConsole, ConsoleReal, and ConsoleTest classes
  • Refactors from debug flag approach to proper console injection for better testability
  • Adds extensive test coverage for console interceptor, console test implementations, and progress proxy extensions

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
ConsoleInterceptor.cs New utility class moved to TestTools namespace for capturing console output during tests
TestConsoleTests.cs Comprehensive test suite for ConsoleTest class covering all console abstraction methods
ProgressProxyExtensionsTests.cs Tests for progress proxy extension methods including console abstraction verification
ConsoleProgressHandlerTests.cs Enhanced with additional test scenarios for empty collections, queryable support, and enumerator variants
ConsoleInterceptorTests.cs New test file for thorough testing of console interception functionality
ProgressProxyExtensions.cs Refactored from WithDebugMode to WithTestMode using proper console injection
ProgressProxy.cs Major refactoring to support console injection and improved progress calculation logic
IConsole.cs New interface defining console abstraction contract
ConsoleTest.cs Test implementation of console interface for unit testing scenarios
ConsoleReal.cs Production implementation wrapping actual System.Console
ConsoleProgressHandler.cs Refactored to use injected console interface instead of static Console calls
Comments suppressed due to low confidence (2)

ConsoleProgressBar/ConsoleProgressBarTests/TestConsoleTests.cs:9

  • The class name 'TestConsoleTests' is confusing as it contains 'Test' twice. Consider renaming to 'ConsoleTestTests' to better reflect that it tests the ConsoleTest class.
public sealed class TestConsoleTests

ConsoleProgressBar/ConsoleProgressBarTests/ConsoleProgressHandlerTests.cs:616

  • Variable name 'blah' is not descriptive. Consider renaming to something more meaningful like 'progressProxy' or 'sut' (subject under test).
		ProgressProxy<int> blah			= fnFooBar()

Comment thread ConsoleProgressBar/ConsoleProgressBarTests/ConsoleProgressHandlerTests.cs Outdated
Comment thread ConsoleProgressBar/ConsoleProgressBar/ConsoleTest.cs Outdated
Comment thread ConsoleProgressBar/ConsoleProgressBar/ConsoleTest.cs Outdated
Comment thread ConsoleProgressBar/ConsoleProgressBar/ProgressProxy.cs
Comment thread ConsoleProgressBar/ConsoleProgressBar/ProgressProxy.cs
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 18, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 65.90909% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...nsoleProgressBar/ConsoleProgressBar/ConsoleReal.cs 11.76% 15 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Flag Coverage Δ
unittests 94.58% <65.90%> (+2.50%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ssBar/ConsoleProgressBar/ConsoleProgressHandler.cs 100.00% <100.00%> (+14.28%) ⬆️
...nsoleProgressBar/ConsoleProgressBar/ConsoleTest.cs 100.00% <100.00%> (ø)
...oleProgressBar/ConsoleProgressBar/ProgressProxy.cs 100.00% <100.00%> (+19.04%) ⬆️
...sBar/ConsoleProgressBar/ProgressProxyExtensions.cs 100.00% <100.00%> (ø)
...nsoleProgressBar/ConsoleProgressBar/ConsoleReal.cs 11.76% <11.76%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@3rikF 3rikF merged commit a555539 into main Jul 18, 2025
5 checks passed
@3rikF 3rikF deleted the enhance_test_coverage branch July 18, 2025 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test The issue contains changes to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants