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

Test attachments are not appearing in the VS Test Explorer #373

Closed
kdubau opened this issue Aug 2, 2017 · 3 comments
Closed

Test attachments are not appearing in the VS Test Explorer #373

kdubau opened this issue Aug 2, 2017 · 3 comments

Comments

@kdubau
Copy link

kdubau commented Aug 2, 2017

Test attachments are not appearing in the VS Test Explorer.

When I use the API TestContext.AddTestAttachement I'm expecting to see these attachments appear in the VS Test Explorer like this:

image

But unfortunately the attachments are not shown.

  • NUnit 3.7.1 and NUnit3TestAdapter 3.8
  • Visual Studio 2017 15.2 26430.16
  • Repro: in a new Class Library project add the NUnit and NUnit3TestAdapter packages. Then add this code and run the test from the test explorer.
using NUnit.Framework;
using System.IO;

namespace ClassLibrary1
{
    [TestFixture]
    public class Class1
    {
        [Test]
        public void Method1()
        {
            TestContext.AddTestAttachment(Path.GetTempFileName());
        }
    }
}

Running it using the console shows the attachment is in the TestResult.xml:

    <test-suite type="TestSuite" id="0-1003" name="ClassLibrary1" fullname="ClassLibrary1" runstate="Runnable" testcasecount="1" result="Passed" start-time="2017-08-02 16:11:28Z" end-time="2017-08-02 16:11:28Z" duration="0.025336" total="1" passed="1" failed="0" warnings="0" inconclusive="0" skipped="0" asserts="0">
      <test-suite type="TestFixture" id="0-1000" name="Class1" fullname="ClassLibrary1.Class1" classname="ClassLibrary1.Class1" runstate="Runnable" testcasecount="1" result="Passed" start-time="2017-08-02 16:11:28Z" end-time="2017-08-02 16:11:28Z" duration="0.020426" total="1" passed="1" failed="0" warnings="0" inconclusive="0" skipped="0" asserts="0">
        <test-case id="0-1001" name="Method1" fullname="ClassLibrary1.Class1.Method1" methodname="Method1" classname="ClassLibrary1.Class1" runstate="Runnable" seed="2053457288" result="Passed" start-time="2017-08-02 16:11:28Z" end-time="2017-08-02 16:11:28Z" duration="0.007199" asserts="0">
          <attachments>
            <attachment>
              <filePath>C:\Users\kywhi\AppData\Local\Temp\tmp598C.tmp</filePath>
            </attachment>
          </attachments>
        </test-case>
      </test-suite>
    </test-suite>
  • .NET Framework 4.6.1
@ChrisMaddock
Copy link
Member

Hmm, no repro on VS 2015. I don't have 2017 here to test it.

Just for the avoidance of any doubt - have you spotted you need to click the 'output' label to view the attachments?

On VS2015, the test initially displays as this:

image

And once you follow the 'output' link:

image

@ChrisMaddock ChrisMaddock added the confirm We need a separate confirmation of this issue label Aug 2, 2017
@kdubau
Copy link
Author

kdubau commented Aug 2, 2017

🤦‍♂️ ...how embarrassing. You are right, need to click output and then it can be seen in the resulting view.

@kdubau kdubau closed this as completed Aug 2, 2017
@ChrisMaddock
Copy link
Member

😄 No problem!

@ChrisMaddock ChrisMaddock added closed:notabug and removed confirm We need a separate confirmation of this issue labels Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants