-
Notifications
You must be signed in to change notification settings - Fork 315
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
[Quesiton] How to run 'dotnet test' without cli? #1224
Comments
I do not believe that's possible today. The test project is not self reliant. In the sense that it does not contain the runner that knows how to run the tests. Still, I will move this issue to microsoft/vstest, maybe they will have some idea there. |
@chuckries please use |
I imagine this is a step in the right direction, but it's still not accomplishing what I'm trying to do. I want to build/publish a project on a machine with an SDK, and then run the outputs on a machine that only has a Shared Framework. When I include Microsoft.TestPlatform.Portable as a DotNetCliToolReference, I do not see vstest.console.dll in the build output or the publish output. Here is what I'm trying:
At this point I have a Here is the listing of the publish output:
|
@codito I think I have figured it out for the time being, but it is not as streamlined as I had hoped. I had to obtain the Microsoft.TestPlatform.Portable nuget package on Windows and copy the contents of the |
@chuckries I think the runner assemblies are not published with |
@chuckries I followed your indications, in a .NET Core 2 solution published on a Raspberry PI, and I could get to run this kind of command: |
@andreabioli This has actually gotten a lot easier now that there is a full .NET Core SDK (as opposed to just the runtime) for linux-arm. The .NET Core 2.1 RC1 SDK for linux-arm can be downloaded here: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.300-rc1-008673/dotnet-sdk-2.1.300-rc1-008673-linux-arm.tar.gz With this SDK you can build and test your project directly on the raspberry pi rather than having to publish it for linux-arm on another platform. Use |
Oh, wonderful news! :-) Thank you very much, I will give a look! |
I played with this for a while because I really wanted to avoid the sdk for no particular reason. I figured out I could use https://www.nuget.org/packages/xunit.console/ and call it's main from my main, hardcoding my app as the test dll. Publish your app and it becomes self executing without the test framework. https://stackoverflow.com/a/64888158/2118268 Not sure if the lack of future development on xunit.console will become an issue at some point, but seems to work for me for netcoreapp3.1 and net5 xunit test apps. |
From @chuckries on October 24, 2017 23:35
I am working on porting the debugger used by the VS Code C# Extension to linux-arm. Today we depend on the 'dotnet test' command to run our unit tests. This will not work for running our unit tests on linux-arm because there is currently no cli available.
I thought I would be able to build the test project on windows and run it on linux-arm against a private shared framework. This works for console apps, but I can't get it to work for a test app.
How can I get a test runner in the output of my test project build that I can run on arm against a shared framework? I thought doing a stand-alone publish would include the necessary pieces, but it doesn't have a test runner in the outputs. I took a quick look at 'dotnet-vstest' form the cli, and it looks like the runner is included in the SDK installation, which I do not have on linux-arm. Is there any way to publish 'vstest.console.dll' with the app? Is there a PackageReference I can add to include the test runner in the build/publish output?
Copied from original issue: dotnet/cli#7898
The text was updated successfully, but these errors were encountered: