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

AddTestAttachment does not work anymore in VS2022 #914

Closed
bernd5 opened this issue Nov 10, 2021 · 14 comments · Fixed by #922
Closed

AddTestAttachment does not work anymore in VS2022 #914

bernd5 opened this issue Nov 10, 2021 · 14 comments · Fixed by #922

Comments

@bernd5
Copy link

bernd5 commented Nov 10, 2021

Description

If the following code is executed:

using NUnit.Framework;

namespace NUnitTest
{
    public class Tests
    {
        [Test]
        public void TestNunitAttachment()
        {
            TestContext.AddTestAttachment(@"C:\Windows\WindowsUpdate.log");
        }
    }
}

The attached file is not clickable (it works with MSTest). I assume the file-scheme is causing the issue.

See the following image:
grafik

Versions

NUnit: 3.13.2
NUnit-Test-Adapter: 4.1.0
.net platform: 5 / 6
Visual Studio edition: VS2022 Enterprise Version 17.1.0 Preview 1.0

@OsirisTerje OsirisTerje added confirm We need a separate confirmation of this issue Investigate labels Nov 13, 2021
@OsirisTerje
Copy link
Member

@bernd5 You mention "file-scheme". Can you elaborate on what you found there?

@bernd5
Copy link
Author

bernd5 commented Nov 13, 2021

It looks like the file scheme is not supported anymore for attached test files in VS2022. But this is just a guess because of the strange highlighting in test explorer.

@bernd5
Copy link
Author

bernd5 commented Nov 15, 2021

Have a look at the tooltip. VS2022 seems to support just a single colon:
grafik

I assume it works simply without the file://-prefix.

OsirisTerje added a commit that referenced this issue Nov 28, 2021
@OsirisTerje
Copy link
Member

Current situation:
VS2022
image
As reported

VS2019
image

Fixed by removing the file:// prefix

VS2022
image

And it still works in VS2019
image

@OsirisTerje OsirisTerje added this to the 4.2 milestone Nov 28, 2021
@OsirisTerje OsirisTerje added is:bug and removed confirm We need a separate confirmation of this issue Investigate labels Nov 28, 2021
@OsirisTerje OsirisTerje linked a pull request Nov 28, 2021 that will close this issue
OsirisTerje added a commit that referenced this issue Nov 28, 2021
* Fix issue #914

* Adding Linux safety belt

* SA error fixed
@bernd5
Copy link
Author

bernd5 commented Nov 29, 2021

Thank you very much for fixing this issue 👍
When is next release published? I would like to update ...

@OsirisTerje
Copy link
Member

Working on getting it out asap. If all go well, by the end of this week.

@vpenades
Copy link

vpenades commented Dec 4, 2021

@OsirisTerje A while ago I opened an issue related to this in VS feedback.

They never fixed it in VS2019 but they claimed it was fixed in VS2022.

Now I've got the opportunity to test in in VS2022 and found the issue remains, and it's related to the "file://" prefix.

I've reopened the VS issue since I believe it needs to be fixed on both sides for maximum compatibility.

@OsirisTerje
Copy link
Member

@vpenades Have you checked the latest version if it works there? (From https://www.myget.org/feed/nunit/package/nuget/NUnit3TestAdapter) . It does seem the file prefix is actually still there, just not being shown in the test explorer, so would be interesting to see if it works or not elsewhere.

@vpenades
Copy link

vpenades commented Dec 4, 2021

@OsirisTerje not sure if I will be able to do that because it would require us to push the nuget into our production pipeline so it can reach our CI environment. I'll give it a look, though.

@OsirisTerje
Copy link
Member

@vpenades You should be able to run it locally just using the same commandline. That would be enough to verify it. Also, alternatively, you don't need to push the package up, you can just refer to the myget source feed. That feed only contains the latest dev packages, and not any releases, they will anyway be picked off nuget.org, so it should not crash with anything else.

@OsirisTerje
Copy link
Member

@bernd5 @vpenades Version 4.2.0-beta.1 released now on nuget.org https://www.nuget.org/packages/NUnit3TestAdapter/4.2.0-beta.1 . It also contains an engine upgrade, which is the reason for the beta. Would appreciate confirmation that it still works for you.

@vpenades
Copy link

@OsirisTerje Sorry for the late reply, I am in crunch time right now, but I'll give the beta a try as soon as I can.

Thanks for the effort!

@bernd5
Copy link
Author

bernd5 commented Dec 12, 2021

For me the new beta works perfectly 👍.
Thank you very much.

@vpenades
Copy link

@OsirisTerje I was able to test the beta1 both within VS2022 test explorer and within TeamCity tests system, and both are able to display the test attachments correctly.

I still believe that Visual Studio should be more forgiving regarding paths, since a "file:///c:xxx" should be valid, but that falls into MS side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants