GHPReporter / Ghpr.NUnit

Adapter for NUnit 3 (generate HTML report for NUnit 3)
http://ghpreporter.github.io/
MIT License
35 stars 14 forks source link

Screenshot added via NUnit TestContext.AddTestAttachment does not display GHPReport #67

Closed msscribner closed 4 years ago

msscribner commented 5 years ago

Screenshot is not displaying in the GHPReport

From a Selenium Test, I'm adding creating a screen shot and adding it to the NUNIT log: TestContext.AddTestAttachment("C:\temp\emailName.JPG");

Generated XML looks something like: image

To generate the GHPReport, I'm including NuGet packages: image

I'm expecting to see the .jpg in the Screenshots link, but it does not display:

image

The test_20191023_191447000.json look like: { "name": "ParallelTest_A_00", "fullName": "AutomationTests.ParallelTests.ParallelTest_A.ParallelTest_A_00", "description": null, "duration": 0.262805, "testStackTrace": " at AutomationTests.Base.BaseTest.ExecuteTest(Action action, DriverType driverType, String strTestName) in C:\TFS\QAAutomation\AutomationTests\Base\BaseTest.cs:line 71\r\n at AutomationTests.ParallelTests.ParallelTest_A.ParallelTest_A_00() in C:\TFS\QAAutomation\AutomationTests\ParallelTest_A.cs:line 106", "testMessage": "System.Exception : Retries Exceeded. Exception: NUnit.Framework.AssertionException: Expected: True\r\n But was: False\r\n\r\n at NUnit.Framework.Assert.ReportFailure(String message) in D:\a\1\s\src\NUnitFramework\framework\Assert.cs:line 394\r\n at NUnit.Framework.Assert.That[TActual](TActual actual, IResolveConstraint expression, String message, Object[] args) in D:\a\1\s\src\NUnitFramework\framework\Assert.That.cs:line 241\r\n at AutomationTests.ParallelTests.ParallelTest_A.<>c.b__2_0() in C:\TFS\QAAutomation\AutomationTests\ParallelTest_A.cs:line 104\r\n at AutomationTests.Base.BaseTest.ExecuteTest(Action action, DriverType driverType, String strTestName) in C:\TFS\QAAutomation\AutomationTests\Base\BaseTest.cs:line 46 1) Expected: True\r\n But was: False\r\n\r\n", "result": "Failed: Error", "testType": null, "output": { "itemName": "test_output_20191023_191447000.json", "date": "2019-10-23T19:14:47Z" }, "priority": null, "categories": [ "P22" ], "testInfo": { "guid": "493c9583-7c24-0582-5194-66ed161b96b3", "start": "2019-10-23T19:14:46Z", "finish": "2019-10-23T19:14:47Z", "itemName": "test_20191023_191447000.json" }, "runGuid": "651dc1f6-0ead-4436-b808-1998debd6979", "screenshots": [], "events": [], "testData": [], "FailedOrBroken": true, "TestResult": 2 }

Desktop (please complete the following information):

elv1s42 commented 5 years ago

Hi @msscribner ! Thank you for the issue, I'll try to reproduce it. Are you running the tests in parallel? Are you doing it on the framework level or on engine level?

msscribner commented 5 years ago

I believe the answer to your question ( framework level https://github.com/nunit/docs/wiki/Framework-Parallel-Test-Execution vs engine level https://github.com/nunit/docs/wiki/Engine-Parallel-Test-Execution) is Framework.level. But in this case, I'm only executing a single test.

Test are configured as: [TestFixture, Parallelizable(ParallelScope.All)]

. . .

    [Test, Category(Category.P22), Retry(1)]
    public void ParallelTest_A_00()
    {
        string strTestName = "ParallelTest_A_00";

        Action action = () =>
        {
            TestContext.AddTestAttachment("C:\\temp\\emailName.JPG");

            //Make a false exception occur

// Assert.IsTrue(false);

        };
        Assert.IsTrue(ExecuteTest(action, DriverType.Chrome,

strTestName)); }

So even though I cam run in parallel, I'm specifically running a single test.

I've attached the generated NUNIT .xml. Shane

On Fri, Oct 25, 2019 at 4:13 AM Evgeniy Kosjakov notifications@github.com wrote:

Hi @msscribner https://github.com/msscribner ! Thank you for the issue, I'll try to reproduce it. Are you running the tests in parallel? Are you doing it on the framework level https://github.com/nunit/docs/wiki/Framework-Parallel-Test-Execution or on engine level https://github.com/nunit/docs/wiki/Engine-Parallel-Test-Execution?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GHPReporter/Ghpr.NUnit/issues/67?email_source=notifications&email_token=AK3KQCXMC35SQR27QSUHX7LQQKTCRA5CNFSM4JEUOUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECHSJ4Y#issuecomment-546252019, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK3KQCVVZ754W4OWTUTX4CTQQKTCRANCNFSM4JEUOUCQ .

msscribner commented 5 years ago

This is the NUNIT report I'm using as input for the GHP Report AutomationTestResults_A_00_10232019_151438.txt

elv1s42 commented 5 years ago

Ok, so am I right that you are using Ghpr.Console to generate the report after test run is finished? Also can you please check that the screenshot <filePath>C:\temp\emailName.JPG</filePath> file exists at the time when the report is generated?

Thank you

msscribner commented 5 years ago

My application calls the API ReportHelper.GenerateReport. ReportHelper.GenerateReport(files.ToArray());

The file 'emailName.JPG' physically exists at the location C:\temp\emailName.JPG.

On Fri, Oct 25, 2019 at 11:36 AM Evgeniy Kosjakov notifications@github.com wrote:

Ok, so am I right that you are using Ghpr.Console to generate the report after test run is finished? Also can you please check that the screenshot

C:\temp\emailName.JPG file exists at the time when the report is generated? Thank you — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or unsubscribe .
elv1s42 commented 5 years ago

Hi @msscribner ! I was able to reproduce the issue, the file AutomationTestResults_A_00_10232019_151438.txt helped a lot, thank you. Going to fix it on this weekend and try to release the next week

elv1s42 commented 4 years ago

Released in v0.9.10