Skip to content
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

Improvements to dotnet-test docs #2382

Closed
mairaw opened this issue Jun 10, 2017 · 2 comments · Fixed by #18167
Closed

Improvements to dotnet-test docs #2382

mairaw opened this issue Jun 10, 2017 · 2 comments · Fixed by #18167
Assignees
Labels
cli/subsvc doc-enhancement Improve the current content [org][type][category]
Milestone

Comments

@mairaw
Copy link
Contributor

mairaw commented Jun 10, 2017

We had several good questions on the dotnet test topic that are good indicators on how we can improve that topic.
This issue has some of the questions and the answers I got from the devs.

• Are there any examples of using "--settings"?
Our docs simply repeat what the CLI help says: “Settings to use when running tests.” It’d be good to add an example to that, what’s the file format expected, file extension, which settings you can use, etc.
Is this topic (https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file) relevant to the --settings? It’s VS specific but it does show how to customize the .runsettings file. Would that be an appropriate link?
Please see https://github.com/Microsoft/vstest-docs/blob/master/docs/configure.md
@codito my suggestion would be to add this topic to the docs here.

• How can I pass additional arguments to the test runner (e.g. XUnit) such as the -nunit parameter to format the output? I see that dotnet run now allows -- to separate arguments but that doesn't seem to apply to dotnet test?
This is supported via runsettings as command line arguments. See item 3 here. User can modify behavior of the adapter from command line. Please note that the architecture in newer dotnet test (1.0 Preview 2+) is different than the ProjectK one. Later versions of dotnet test don't call dotnet-test-xunit.exe directly, instead they work with adapters. For this specific ask, I don't think there is a xml reporter available for nunit yet (nunit/nunit3-vs-adapter#215). I've created an issue for a logger extension here: https://github.com/Faizan2304/LoggerExtensions/issues/7

• Is there a way to set the location for where the tests are run?
.NET Framework tests are run from the bin/debug folder, but for the dotnet test projects, they are run from where ever I run the DOTNET TEST command. This makes it awkward to copy files that should be available for the tests.
For instance .... if I run am in the solution root folder and run "DOTNET TEST PROJECT.UNITTESTS/project.json" ... the tests will when executing read as default, from the solution root folder. If I run the test from within VisualStudio, I am IN the UnitTest project folder ...
Are there any "undocumented" properties that I can set, for the tests to always run in - for instance, the output folder, as in .net fw?

I am not sure if dotnet test is doing something special here, but msbuild always runs in the context of the project being executed. You mention project.json above, so I wonder if this is coming from people using the old tooling, in which case, we won’t really support improvements there.
In csproj world, dotnet test and vstest always run tests from output directory. User can use AppContext.BaseDirectory to consume test assets in the output directory.

• How can I run a single specific test?

You can do that using dotnet test --filter=”FullyQualifiedName=<test_name>” which will match tests with exactly the fullyqualified name or dotnet test --filter=”FullyQualifiedName~<test_name>” which will match any tests that have that name.
Please see https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md. Also dotnet test --filter mytest is a shortcut for dotnet test --filter FullyQualifiedName~mytest.

• It is not clear how to test a class library. What frameworks and testrunners are supported. There are no examples of actual tests!


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@mairaw mairaw added Area - Conceptual Docs doc-enhancement Improve the current content [org][type][category] labels Jun 10, 2017
@mairaw mairaw added this to the June 2017 milestone Jun 10, 2017
@guardrex
Copy link
Contributor

Cross-reference: Tracking NUnit progress for dotnet/docs on #1785, which links thru to NUnit-.NET Core adapter tracking on nunit/nunit3-vs-adapter#297.

@mairaw mairaw modified the milestones: 2017 - Quarter 3, June 2017 Jul 3, 2017
@mairaw mairaw modified the milestones: 2017 - Quarter 4, 2017 - Quarter 3 Sep 11, 2017
@mairaw mairaw added the P1 label Dec 11, 2017
@mairaw mairaw modified the milestones: 2017 - Quarter 4, Backlog Dec 11, 2017
@BillWagner BillWagner added Pri0 Indicates issues or PRs that are critical priority and removed P1 labels Jun 18, 2018
@BillWagner
Copy link
Member

We've delayed this several times, so I upped the priority for visibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli/subsvc doc-enhancement Improve the current content [org][type][category]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants