28873

Reporting tool for Nunit 3 and Selenium C#

Question:

I'm using Selenium with C# to create my automated tests. Now i have to use some sort of reporting tools to save the test cases whether they passed,failed...etc.

<blockquote>

I've seen a lot of tools like Allure, and Jenkins. But they require an XML file. and i can't find it when i run my tests using Visual 2013. Why is that ?

</blockquote>

<strong>how to obtain these XML files in details if i'm missing something</strong> ?

Is there any way i could achieve this with minimum effort ?

<strong>EDIT:</strong> How can i run my tests using Nunit console runner ? where can i find it? i downloaded the .zip for nunit but i couldn't find the runner?

Answer1:

The NUnit Visual Studio Adapter does not currently produce XML results, although there is an <a href="https://github.com/nunit/nunit3-vs-adapter/issues/215" rel="nofollow">issue on GitHub</a> to add the ability. Your best bet is to run your tests using the NUnit Console runner when you want to create reports. It always produces an XML result file.

You can install the NUnit Console by adding the <a href="https://www.nuget.org/packages/NUnit.Console/" rel="nofollow">NUnit.Console</a> NuGet package to your test project. The console will be in a directory like packages\NUnit.ConsoleRunner.3.4.0\tools in your solution root.

Another option is to install the <a href="https://github.com/nunit/nunit/releases" rel="nofollow">MSI for the console runner</a>. It will then be under C:\Program Files (x86)\NUnit.org\nunit-console

For creating reports, <a href="http://reportunit.relevantcodes.com/" rel="nofollow">ReportUnit</a> creates excellent HTML reports from your test results.

To run the tests, I would recommend setting up a simple command line build that builds your solution, runs the tests and then produces the report. For day to day development, just running your tests in Visual Studio or on the command line will likely be enough. Most developers find the Visual Studio Test Explorer Window to be a poor UI, but usable for seeing passed and failed tests and running/debugging them.

If you want to setup a command line build, one good tool is <a href="http://cakebuild.net/" rel="nofollow">Cake Build</a>. It will take a bit of time to setup, but it is an excellent way to run your build tasks as your project gets larger.

Answer2:

NUnit testing can be run with the nunit-console.exe application which is installed with nunit under {Project_root}/lib/nunit/nunit-console.exe. It downloads with NuGet when NUnit installs.

It can be passed a list of testing binaries, or testing project files, or an nunit project (listing multiple if needed).

{PathToProject}\lib\nunit\nunit-console.exe {PathToTestDll}\Project1.Tests.dll {PathToTestDll}\Project2.Tests.dll /xml=nunit-result.xml

or create an NUnit Project with the <a href="https://github.com/nunit/nunit-project-editor" rel="nofollow">NUnit Project Editor</a> if you want to group all your test projects into a single config file.

{PathToProject}\lib\nunit\nunit-console.exe {PathToNUnitProject}\Project.Tests.nunit /xml=nunit-result.xml

Recommend

  • Where is Create Unit Test in VS 2017?
  • How do you stop the DiaSession warning from TFS CI build when using NUnit?
  • Loading nunit project file (example.nunit) during Specflow feature execution
  • Inconsistent test results when using dotCover
  • TestFixtureSetUpAttribute not found in JustMock?
  • Nunit Tests order of Execution
  • Servicestack client compression fails with generic lists
  • Does c# have a rspec like testing framework that makes grouping like tests together?
  • How to get the relative position of a Dictionary element?
  • Can I customize a Jackson ObjectMapper by adding a module?
  • C++ accessing vector
  • FragmentActivity with a Fragment Containing a MapView
  • Many to many relationship core data query for specific collection
  • How to make SASS put relative paths in its output
  • Iterate twice through a DataReader
  • Fat binaries in iOS
  • Classic ASP URL Rewriting
  • Put value at centre of bins for histogram
  • using html data-attributes as css-variable (i.e. text-shadow)
  • How to generate and display a QR Code in ionic 2
  • Limiting recursion to certain level - Duplicate rows
  • Display issues when we change from one jquery mobile page to another in firefox
  • Different response to non-authenticated users and AJAX calls
  • Is there a amazon webstore API for customers?
  • Shallow update not allowed (git > 1.9)
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Upload files with Ajax and Jquery
  • How to pass list parameters for each object using Spring MVC?
  • How do I rollback to a specific git commit
  • Data Validation Drop Down Box Arrow Disappearing
  • Revoking OAuth Access Token Results in 404 Not Found
  • json Serialization in asp
  • Proper way to use connect-multiparty with express.js?
  • Angular 2 constructor injection vs direct access
  • how does django model after text[] in postgresql [duplicate]
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • Programmatically clearing map cache
  • UserPrincipal.Current returns apppool on IIS