Favourite Quote

Every artist was first an amateur. - Ralph Waldo Emerson The more difficulties one has to encounter, within and without, the more significant and the higher in inspiration his life will be. - Horace Bushnell

Thursday, April 19, 2012

Generating HTML report for NUnit with Nant


In my earlier post we saw how we can get the NUnit runner with our Visual Studio 2010 ultimate.

Now let's look at how to generate reports in html format.

Steps invloved in generating a html report for nunit tests :

1. Download Nunit2report from http://sourceforge.net/projects/nunit2report/ and unzip it to a location just like in the screen shot

2. Download Nant from http://nant.sourceforge.net/ if you don't have already place it in a location suitable to you

3. Once you are in Nunit2Report bin directory - You must have these files just like i have in screen shot

4. Copy all files from the bin directory of Nunit2Report to Nant/bin directory - Just as in screen shot

5. Add reference to Nant with Visual Studio 2010

6. Click on Tools Menu in Visual Studio and click on External Tools - Just like in Screen shot

7. Add details just like i have entered in the external tools configuration for nant

8. You can either follow step 7 for integrating Nant with Visual studio or just create a batch file with details $NANT_HOME\bin\nant.exe -buildfile

9. Let's look at how our build file looks - Have a look at the screen shot

10. You should see a nice html report - Just like screen shot

11. We can add a task to email results as well using the mail task
automationwithselenium.blogspot.com-Google pagerank and Worth

12 comments:

  1. Hi Shabana, thanks for posting this. Could you please tell me where to save this Build file in Step 9? I saved it under the project folder/bin but it never created any HTML report. Any help you provide is much appreciated!

    ReplyDelete
    Replies
    1. Shabana, Please check the point no 9 which has snapshot if the build file. I hav created the .build file and am able to generated the HTML report

      Thanks to the Author for posting it step by step

      Delete
    2. @VG : It would be in your solution

      Delete
    3. @Kiran, thanks that you felt it was of help to you :)

      Delete
  2. i am unable to generate reports ....can any one help me out how to generate HTML report in detailed ........

    ReplyDelete
  3. Hi can anyone suggest me how to generate HTML reports using Nunit only.

    ReplyDelete
    Replies
    1. Sory .. for not replying on time
      Did you follow the exact steps .. please be specific as to where you are seeing error

      Delete
  4. Thanks dude i am getting it...@VG place your batch file in /bin/debug.

    ReplyDelete
  5. Very nice piece of code. Able to generate report by simply following the steps.
    This was really required. Thanks a lot.

    ReplyDelete
  6. Hi

    Please answer my queries
    1. do we require build.xml if yes where to place it (specific location)
    2. where we will get the .html file


    if u can paste code it will be beneficial

    Thanks

    ReplyDelete
  7. Once we unzip Nunit2report . where exactly we need to place this .? C drive .? D drive .? Where .?

    ReplyDelete
  8. I need few clarifications here, Please find the below points:
    1. At step 9 you have mentioned "Our build file looks like this" and you have provided the screen shot. Should we have to manually write that build file u have shown in the screen shot and place the file in a specific location? If yes, please specify the location.

    2. How do I run my Nunit tests to generate the HTML reports?
    I run my Nunit test by going to test explorer and by selecting all the tests I want to run and then I select "Run Selected test". Should I be following this or anything else to generate the report?

    ReplyDelete