-
Notifications
You must be signed in to change notification settings - Fork 554
[tests] Use 'ExecuteTask' to execute a task instead of 'Assert.IsTrue (task.Execute ())' #24550
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
….IsTrue (task.Execute ())' Use 'ExecuteTask' to very a task execution instead of 'Assert.IsTrue (task.Execute ())', because 'ExecuteTask' has much better failure reporting.
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.
Pull request overview
Updates MSBuild task tests to consistently run tasks via TestBase.ExecuteTask to improve failure diagnostics in test output.
Changes:
- Extend
TestBase.ExecuteTaskwith an optionalmessageparameter to add context to assertion failures. - Replace direct
Assert.IsTrue/IsFalse (task.Execute ())usage across multiple task tests withExecuteTask(...). - Simplify some tests by letting
ExecuteTaskassert success/failure and expected error counts.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs | Adds optional message parameter to ExecuteTask and includes it in assertion messages. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/PropertyListEditorTaskTests.cs | Switches to ExecuteTask for success/failure execution assertions. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ParseBundlerArgumentsTests.cs | Uses ExecuteTask and supplies per-variation context via the new message parameter. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MergeAppBundleTaskTest.cs | Replaces direct Execute() assertions and error-count checks with ExecuteTask. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/LocalizationStringTest.cs | Uses ExecuteTask (task, 1) for expected-failure execution. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetPropertyListValueTaskTests.cs | Uses ExecuteTask for expected success/failure paths. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetBundleNameTaskTests.cs | Uses ExecuteTask and relies on it for error-count validation. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/DetectSdkLocationsTaskTests.cs | Uses ExecuteTask (task, 1) to assert expected failure and error count. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CreateBindingResourceTaskTests.cs | Switches to ExecuteTask for task execution (currently introduces a name-hiding compile issue). |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ComputeCodesignItemsTaskTests.cs | Replaces direct Execute() assertions with ExecuteTask. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CollectITunesArtworkTaskTests.cs | Uses ExecuteTask for both expected failure and success paths. |
| tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CollectBundleResourcesTaskTests.cs | Uses ExecuteTask and removes redundant manual checks of Execute() return value. |
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CreateBindingResourceTaskTests.cs
Show resolved
Hide resolved
✅ [CI Build #424e9a4] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #424e9a4] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ [CI Build #424e9a4] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #424e9a4] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #424e9a4] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #424e9a4] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #424e9a4] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #424e9a4] Tests on macOS arm64 - Mac Tahoe (26) passed 💻✅ All tests on macOS arm64 - Mac Tahoe (26) passed. Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #424e9a4] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 119 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download Pipeline on Agent |
Use 'ExecuteTask' to execute a task instead of 'Assert.IsTrue (task.Execute ())',
because 'ExecuteTask' has much better failure reporting.