-
-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor FUnit to use a nested TestSuite class #6
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
Conversation
This refactoring addresses the TODO in FUnit.cs by introducing a nested `TestSuite` class to encapsulate test aggregation and execution logic. Key changes: - The `FUnit` class is now a `partial` class. - A new nested class `TestSuite` is created within `FUnit`. - Test aggregation logic is moved to the `TestSuite` constructor. - Test execution logic is moved to the `TestSuite.ExecuteAsync` method. - A `Build` method is added to `FUnit` to create `TestSuite` instances. - `FUnit.RunAsync` is updated to use the `TestSuite` class and handles logging via events. - Events (`TestRunStarting`, `SubjectStarting`, `TestCaseSkipped`) are introduced in `TestSuite` to decouple execution from logging.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll acknowledge your comments with a 👀 emoji and then get to work. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! I will automatically address your feedback. For any comments you don't want me to act on, just include (aside). For security, I will only act on instructions from the user who triggered this task for this pull request. |
The `TestCaseSkipped` event in the `TestSuite` class was exposing the internal `TestCase` type in its public API. This commit changes the event signature to use a tuple `(string subject, string description)` instead, which provides the necessary information without exposing internal implementation details. The event handler in `FUnit.RunAsync` has been updated accordingly.
| } | ||
| } | ||
|
|
||
| public async Task<(List<FailedTestCase> failed, List<TestCase> skipped)> ExecuteAsync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should return TestResult instead. change TestResult.Test to have TestResult.Error list. (current: Error?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I've refactored TestSuite.ExecuteAsync to return a TestResult object directly. I've also updated TestResult.Test to hold a list of errors as you suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so many changes applied, revert it to previous one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reverted the changes as you requested. The code is now back to the previous state.
This commit refactors `TestSuite.ExecuteAsync` to construct and return the `TestResult` object directly, instead of a tuple of failed and skipped tests. This simplifies the `FUnit.RunAsync` method and centralizes the test result creation logic within the `TestSuite`. Additionally, the `TestResult.Test` record has been updated to hold a list of errors (`IReadOnlyList<Error>`) instead of a single nullable error. This allows for capturing multiple errors for a single test case, which might be useful for features like running tests multiple times.
This reverts the previous commit that refactored `TestSuite.ExecuteAsync` to return a `TestResult` object. The change was deemed too extensive and has been reverted as per user feedback.
This change refactors the
FUnitclass to use a nestedTestSuiteclass. This improves the structure of the code by separating the test execution logic from the mainFUnitclass.PR created automatically by Jules for task 4991649363410170469