How do I generate an Allure report in NUnit 3? - nunit

I feel like I'm missing something obvious, but I haven't found an answer anywhere else.
I have set up Allure as described in the documentation for NUnit 3. After I run my tests through the VS Test Runner I can see the result.json and attachment.txt files in my allure-results directory, but I don't understand how this translates into the actual Allure report, shown at https://raw.githubusercontent.com/unickq/allure-nunit/master/AllureScreen.png.

Related

OpenCover not finding solution modules

I'm trying to use OpenCover to produce some code coverage reports for my solution. I've got it running with assistance from this blog post http://www.allenconway.net/2015/06/using-opencover-and-reportgenerator-to.html, but it's currently not identifying and loading the modules which I want to report on.
Here is what I'm executing:
"%~dp0..\packages\OpenCover.4.7.922\tools\OpenCover.Console.exe" ^
-register:user ^
-target:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\mstest.exe" ^
-targetargs:"/testcontainer:\"%~dp0..\My.Project_Tests\bin\Debug\My.Project_Tests.dll\" /resultsfile:\"%~dp0My.Project.trx\"" ^
-filter:"+[My.Project*]* -[My.Project_Tests]*" ^
-mergebyhash ^
-skipautoprops ^
-output:"%~dp0\GeneratedReports\WebsiteReport.xml"
The output I get:
No tests to execute.
Committing...
No results, this could be for a number of reasons. The most common reasons are:
1) missing PDBs for the assemblies that match the filter please review the
output file and refer to the Usage guide (Usage.rtf) about filters.
2) the profiler may not be registered correctly, please refer to the Usage
guide and the -register switch.
I've tried changing the filter to include everything:
-filter:"+[*]*"
This finds and reports on code coverage within the test project, but doesn't manage to identify or report on coverage in any of the referenced projects which I actually want to test (My.Project).
The projects are all being built and .pdb files are present in the bin folder of the test project.
I would like code coverage reports from all projects referenced by my test project. Does anyone have any idea what's going wrong?
Turns out that I'm an idiot and was running MSTest when I should have been running NUnit console since our tests are all using NUnit.
Posting this just in case it helps someone else out.

How to enable the code coverage view on VSTS?

My team uses VSTS with hosted agents and a Visual Studio Test build task to run all tests and produce code coverage. However the tab Code coverage remains empty afterwards, only showing a link to download the *.coverage file.
I actually expect the code coverage results to be shown, with tables and graphs which projects are tested and it's respective coverage.
We are using the Visual Studio Test build task to test net461 assemblies with the Code Coverage enabled checked.
Somewhat related are both this and this issue, but not entirely, because we are just using MSTest Framework with built-in Visual Studio Test build task, which (I understand) should also automatically publish the code coverage results.
Am I missing something to get this Code coverage view working? Thanks!!
In Code coverage Tab, you need to use Publish Code Coverage Results task to show tables and graphs there.
While for Publish Code Coverage Results task, it only supports Code Coverage data in Jacoco or Cobertura formats. So the result of the *.coverage file can not be shown by tables and graphs in Code coverage Tab.
More details, you can refer the blog Browse Code Coverage reports and the issue How to publish the code coverage result with a .coverage file.

Report Generation in Specflow

I am using specflow to create my feature files using GWT scenarios in visual studio 2015. When I use Specflow + Runner I am able to to see the report generated for the test. But I use Nunit for the execution I am not able to view report. How can I see the XML report file?
Does the Nunit test Runner Produce any result report?(Specflow + Runner produce HTML report) In many websites it is mentioned as Nunit gives TestResult.XML
Use Pickles to create documentation for Specflow.

Allure and Hapi Lab coverage reports

I am in the process of trying to figure out if we can use the Allure plugin for TeamCity to show code coverage, and completed tests in our build pipeline.
All of the tests for our web services are written in CoffeeScript using Hapijs Lab.
When we run the tests now we use 'npm test' and once the tests complete a coverage.html document is generated.
Does anyone know of a way that I can convert this coverage.html report into a format that Allure would understand? From what I have read it seems that Allure is expecting XML. Does anyone have experience in converting an existing report into XML?
When you run your lab tests you can add the flag:
lab tests.js --reporter junit
And you will get a junit style xml output.
Then you need to make sure you have the JUnit adapter installed for allure. You can find info about that here:
https://github.com/allure-framework/allure-core/wiki/JUnit

Process NUnit result.xml and show it in Team City Web GUI

I remember doing this in an older version of Team City in which the NUnit Runner failed, so I tried running NUnit using the Command Line Runner instead.
I think there was an option in the Command Line Runner settings which let you specify the kind of output file: NUnit result.xml was one of them. Doing this, you could see the test result breakdown in the Web GUI, just like when the NUnit Runner worked.
But I don't see this in the latest Team City (6.5.5). Can it still be done?
PS: Before anyone asks, I can't use Team City's NUnit Runner because NUnit has a bug which will be fixed in the soon to come 2.6.0 version. Said bug does not occurr when running nunit-console
This could be done using importdata TeamCity message, this is really helpful when you are running NUnit tests manually executing nunit-console.exe from an MSBuild script, for instance using NUnit MSBuild Community Task, but keep in mind that TeamCity provides built in NUnit tests runner so you do not need this low level TeamCity scripting. Anyway you can import report in this way:
<Message
Text="##teamcity[importData type='nunit' path='...\TestResults.xml']"
Importance="High"/>
See Importing XML Reports
If you prefer to run code coverage, code inspection, test tools or
duplicate finders directly from build script, not as a build runner,
you can use the importData service messages to import generated xml
reports into TeamCity.
The functionality was still there, found it by accident when looking at another build configuration. Importing an XML is now a "Build Feature", see: