-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Test environment is ignored #475
Comments
Have you set RunMsCodeCoverage Yes ? |
Hello Tony, |
Can you provide all the steps you go through for the tests to be run in a Linux container. Have you done all the prequiisite remote Linux environment steps in https://learn.microsoft.com/en-us/visualstudio/test/remote-testing?view=vs-2022 ?
from https://learn.microsoft.com/en-us/visualstudio/test/remote-testing?view=vs-2022
FROM mcr.microsoft.com/dotnet/sdk:5.0 RUN wget https://aka.ms/getvsdbgsh && Is this necessary in your dockerfile ? |
You should use this in your test project when not using ms code coverage
|
Can you show what is written to the FCC Output Window Pane after running tests with RunMsCodeCoverage No ( with the UseDataCollector element added ) and with RunMsCodeCoverage Yes. |
I am not sure if Microsoft support coverage for remote testing - microsoft/codecoverage#132 |
I open the solution above (https://github.com/mdima/traceroute), I select as test environment "linux container", I run the tests.
Yes, I did.
I followed that instructions
If I add this to my dockerfile it reports an error (I also tried the following): |
With RunMsCodeCoverage No:
With RunMsCodeCoverage Yes:
|
Exactly, I am running Visual Studio Professional 2022 (Version 17.12.3) |
With RunMsCodeCoverage No FCC has no concept of docker. Have you run your tests in the docker Linux environment outside of Visual Studio ? If so please provide the details. FCC would need to get a file from Linux to Windows. Is that possible ? As for RunMsCodeCoverage Yes. |
Also the examples from https://learn.microsoft.com/en-us/visualstudio/test/remote-testing?view=vs-2022
|
Hello, I did not run test directly outside Visual Studio, I don't think it is possible or useful (maybe there is some way to grab the command line from VS, but after you run that you will go nowhere).
Well, I also have Windows 11 with Docker Desktop, this is how I run the project above. You don't need anything else :) . |
Yes, you are right. I changed the base image to the SDK version and I pushed everything in the repository. Anyway, it did not change the result, FCC still reports "No cobertura files for ms code coverage." when RunMsCodeCoverage is set to Yes. Thank you, |
PS - here you will find the project updated as above: |
I think it is possible and if it is possible then it is useful as we will then be able to attempt to collect the code coverage for you to display in Visual Studio.
What makes you believe that the container is Linux ? |
Hello,
Well, I arrived to run in the container:
The base image of the container is Debian (you can check it in Docker Desktop), both for the release container than the test container. |
Yes that it is the file. So with a combination of If you could provide a working docker command then we could incorporate the logic |
Yes, so in the end if I run in the Docker container (in the /mnt/approot/UnitTests folder): I receive the following result:
and after that I have a TestResults/25a70cb8-d3f4-458e-bc25-69343784f60b/coverage.cobertura.xml file in the UnitTest project folder (the /mnt/approot/ is mapped from the host to the Docker container). I just pushed the code to the repository. Thanks, |
Great, but I am looking for a command that can be run on windows. Also, have you looked to see if any of the docker samples have tests and to run one of them in the remote environment to see if a coverage file is provided to FCC with RunMsCodeCoverage Yes ? |
I think that the Visual Studio Test Window supports coverage but not through a test adapter path outside of the solution directory. I will look at adding the required code coverage dlls to the bin folder and adjusting the path. |
Installed product versions
Description
The test environment is ignored during the coverage tests
Steps to recreate
Current behavior
The tests are performed in the "Local Windows Environment"
Expected behavior
The tests are performed in the "linux container" environment
Side Notes
If you debug some of the tests above, you will see that some of the tests are performed during the test execution, but their lines are reported as not covered by FCC.
The text was updated successfully, but these errors were encountered: