0

One of my colleague working in java write test cases for his development. As he rebuild, all his testcases will execute on his code and result either fail or passed.

I am workin in .NET, I would like to do similar approach for my application (TDD). Which will perform this automated testing of my code.

What is best approach for writing test cases for window service. We have VS2010 testing, Nunit and CSUnit?

Can anyone give examples for it as I never done this before?

I am fetching some WMI data in service and performing some rest calls, what would be testcases for such operations?

Thanks

sunder
  • 1,803
  • 4
  • 29
  • 50
  • possible duplicate of [How can I unit test a Windows Service?](http://stackoverflow.com/questions/42150/how-can-i-unit-test-a-windows-service) – Emond May 07 '12 at 05:39
  • but whats best approach to test your code by using VS2010 test suite or NUNIT or CSUnit or what. Any Example. – sunder May 07 '12 at 05:44
  • I am working with .NET4.0 and VS2010 – sunder May 07 '12 at 05:44
  • Before we can state "what is best" you need to specify what the attributes are on which you want to compare these frameworks. – Emond May 07 '12 at 08:57

2 Answers2

1

There is a lot of discussion on the web concerning unit test frameworks. It seems that it's matter of personal taste and what you need to get done. The functionality between the frameworks is usually very similar. Here are a couple of links about comparing available unit test frameworks.

Personally i recommend NUnit. It has been around for a long time and it's very mature. And it's free! You can find detailed documentation on the project's homepage. Here is a quick start article.

Community
  • 1
  • 1
Marek Dzikiewicz
  • 2,844
  • 1
  • 22
  • 24
-1

It's probably not a good idea to test against the running windows service, because that would be an integration test ... That includes: Does the service run with the right permissions, is the deployment complete etc.

It's better to test the functionality of your windows service classes directly by referencing the DLLs from your testing framework.

Therefore it doesn't matter if you use NUnit, Visual Studio Testing or what ever. That depends on your favors.

BitKFu
  • 3,649
  • 3
  • 28
  • 43
  • I have my window service up and running perfectly. Apart from that I have it deployed in different modes. I can run it as a console also. I have a different model layer for which I want to write the test cases. And I have all rights, I am running under administrator account. – sunder May 07 '12 at 06:17