-
Notifications
You must be signed in to change notification settings - Fork 1.2k
dotnet CLI: Reorganize dotnet.Tests folder structure + other #48280
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
…since it was unused. Moved dotnet-msbuild.Tests and dotnet-sln.Tests to the dotnet.Tests project. Moved crossgen.Tests, dotnet-back-compat.Tests, and dotnet-completions.Tests to appropriate folders within dotnet.Tests. Renamed dotnet-new.Tests folder to dotnet-new.IntegrationTests. Moving dotnet-format.UnitTests up, and will rename folder in next commit.
… to mention that I previously moved the dotnet-sln.Tests to dotnet.Tests.
….UnitTests.csproj build. Renamed misnamed file.
…ent in dotnet.Tests.csproj.
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.
Copilot reviewed 983 out of 990 changed files in this pull request and generated no comments.
Files not reviewed (7)
- .editorconfig: Language not supported
- CODEOWNERS: Language not supported
- TemplateEngine.slnf: Language not supported
- sdk.sln: Language not supported
- src/BuiltInTools/dotnet-format.slnf: Language not supported
- src/Tasks/Microsoft.NET.slnf: Language not supported
- test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/.editorconfig: Language not supported
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 looked at the tree in the file view to see the resulting structure (it is very hard to review large amounts of renames in Github. even more if half the path gets hidden away and you have to hover over every file) and it makes sense to me.
I like how dotnet.Tests.CommandTests matches the structure of the commands folder.
For format, msbuild, and new, would using dashes (-) not cause the same namespace issues Just read the part about renaming on the PR description :)dotnet-sln.Tests had for your previous PR
…ing inclusion of test assets and fixed formatting. Fixed comment typo.
# Conflicts: # test/dotnet.Tests/dotnet.Tests.csproj
|
|
||
| #nullable disable | ||
|
|
||
| using Microsoft.DotNet.Cli.Commands.Package.List; |
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 no context whatsoever about this file other than what we talked about offline, but is there a reason this isn't required for accessing ListPackageCommand??
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.
That isn't what you think it is. ListPackageCommand is this. What that is is a basically a way for the tests to execute dotnet list package. Meaning, this class has nothing to do with the actual class, which is here, but it will run the command, which eventually calls the code in that class. So, it doesn't directly access the code programmatically, but it does access it from running the CLI. All this is quite old.
To further clarify on the CLI, dotnet list package and dotnet package list do call that same code, @Forgind 's changes just has a shim for the former that calls the underlying code of the latter. So, unless we actually remove that shim, all this still is testing the same bits.
Lastly, this isn't a traditional "unit test" since it doesn't access the product code directly. It is actually an end-to-end test on a single feature since it executes the entire product to test this functionality.

Summary
It was driving me a little crazy at how confusing the
testfolder structure was. There are different generations of tests and test projects that exist in this folder. It seems most just migrated things here but never did the due diligence to make things make logical sense. Instead, they just kinda jammed a bunch of<Compile>nodes into thedotnet.Testsproject and called it a day.What did I do? I looked at generally where things should go based on the structure that I recently revamped in the
dotnet.csproj. Ironically, you can get a decent idea of the history of the test projects by looking at theAssemblyInfo.csfor thedotnetproject. Then, I tried to figure out if anything else should be included. This PR, IN NO WAY, is the ideal structure, naming, or amount of TLC that is actually needed for this stuff. But it is a first blush to get things a bit more organized.Changes
dotnet.Testsproject that mimics the folder hierarchy of thedotnetprojectCommandTestsfolderdotnetproject, such asCommandFactoryTests,ShellShimTests, etc.dotnet-XXXXXfolders that only contained .CS files into thedotnet.Testsprojectdotnet-msbuild.Testsanddotnet-sln.Testsintodotnet.Testsprojectdotnet-new.Testsfor thedotnet-new.IntegrationTestsproject todotnet-new.IntegrationTestsdotnet-format.Tests/testsfor thedotnet-format.UnitTestsproject todotnet-format.UnitTestsMicrosoft.NET.Sdk.Razor.SourceGenerators.Tests/.editorconfigsince it was unusedAssemblyInfo.csfor thedotnetproject since it was sharing internals with projects that no longer existOther Information/Not-Changes
ConfigurerTestsfolder in thedotnet.Testsproject, since they already existed in this project. However, I think that they somehow relate to the assemblyMicrosoft.DotNet.Configurer, but this has no separate test project. I think the right thing to do would be to make a separate test project for this assembly. But I didn't do that in this PR.Microsoft.DotNet.PackageInstall.Testsproject could actually be integrated withdotnet.Testssince it tests theToolPackagelogic fromdotnet.csproj. However, this project has a bunch of custom configuration with in the .CSPROJ and wasn't worth the effort to combine withdotnet.Tests. Thus, remains a separate project.dotnet.Testsafter investigationcontainerize.UnitTeststestscontainerizewhich is a separate tool used by VSdotnet-format.UnitTestsis fordotnet-formatwhich is a separate dotnet tooldotnet-MsiInstallation.Testsis for the VM-based installation testsdotnet-new.IntegrationTestsis the separatedotnet newset of tests based on the Templating repo integrationdotnet-watch.Testsis fordotnet-watchwhich is a separate dotnet toolMSBuildtest projects (not dotnet CLI related)Microsoft.NET.Build.TestsMicrosoft.NET.Clean.TestsMicrosoft.NET.Pack.TestsMicrosoft.NET.Publish.TestsMicrosoft.NET.Rebuild.TestsMicrosoft.NET.Restore.TestsMissing Tests????
I did not find tests for the following commands: