reportportal / agent-net-nunit

Report Portal integration point with NUnit 3
Apache License 2.0
21 stars 10 forks source link

Reports not coming to RP via local run in Visual Studio (.NET Framework 4.7.2) #79

Open kmlqsf opened 2 years ago

kmlqsf commented 2 years ago

Im trying to configure project with Report Portal. I tried on VS 2019 and 2022.

It works running with CI, but not locally.

Project references have NUnit, NUnit3TestAdapter, ReportPortal.NUnit (tryied ReportPortal.VSTest.TestLogger also).

Running Test from Test Explorer or ReSharper Unit Test Session (need to run in at least one of the options). Target Framework: .NET Framework 4.7.2 Tried all variants of settings in Tools>Test

offtop: I did a big refactor of an old project, I couldn't run ReportPortal to work locally for about 2 weeks, but then after some change in the project, the reports started to pass. After I tried to run them through the resharper runner (to check whether reports would come through it), the reports stopped coming at all and I could not return the state when they were working.

Test Output:

[2/17/2022 7:22:28.984 PM] ========== Starting test run ==========
[2/17/2022 7:22:28.985 PM] Tests run settings for D:\MyProject.UITests\Tests\bin\QA\AccountsTests.dll:
 <RunSettings>
  <RunConfiguration>
    <ResultsDirectory>D:\MyProject.UITests\Tests\TestResults</ResultsDirectory>
    <SolutionDirectory>D:\MyProject.UITests\Tests\</SolutionDirectory>
    <CollectSourceInformation>False</CollectSourceInformation>
  </RunConfiguration>
</RunSettings>.
[2/17/2022 7:22:29.194 PM] Multiple versions of same extension found. Selecting the highest version.
  NUnit3.TestAdapter : 4.2.0.0
[2/17/2022 7:22:29.501 PM] NUnit Adapter 4.2.0.0: Test execution started
[2/17/2022 7:22:29.526 PM] Running selected tests in D:\MyProject.UITests\Tests\bin\QA\AccountsTests\bin\QA\AccountsTests.dll
[2/17/2022 7:22:29.832 PM]    NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
[2/17/2022 7:22:47.692 PM] NUnit Adapter 4.2.0.0: Test execution complete
[2/17/2022 7:22:47.721 PM] ========== Test run finished: 1 Tests (1 Passed, 0 Failed, 0 Skipped) run in 18.2 sec ==========
[2/17/2022 7:22:47.739 PM] Test run animation has stopped.
[2/17/2022 7:22:47.739 PM] Test run progress has stopped.
nvborisenko commented 2 years ago

Visual Studio is smart and sometimes it confuses me. The root cause of this issue is that VS loads NUnit3.TestAdapter from nuget local cache, not from your D:\MyProject.UITests\Tests\bin\QA output folder. Bug or feature? At least MS documented it somewhere.

As a solution I can propose to change target framework to .netcore3.1+ or net5.0+. In this case VS always picks up adapter from output folder, as CLI always does it. Bug or feature? But it works :)