views:

150

answers:

3

I have an API that can be implemented by various vendors. I can send and receive data and get different return codes with the API.

What I want to do is be able to test the API and in an automated fashion and keep everything as clean as possible. Not really doing unit testing. This would be for use in a testing/QA setting.

What I have done is to create a dummy app in C# and use NUnit to create a suite of tests. So I have all the tests in different classes based on functionality and I can start up NUnit and run my tests and see my results. I like how I can do setup and tear down. This allows me to get the API into a known state. I also like the assertion methods in NUnit.

I don't think this is the intention of NUnit, I would expect most people use NUnit inside of their app to test their own code. My question is, how bad is what I am doing? And what would be better?

+2  A: 

This sounds fine, I think. I imagine if you didn't use NUnit, you'd just write something yourself that was a poor copy of NUnit, so stay with it.

Steve Cooper
+1  A: 

What you are doing is perfectly legitimate. Just because the author may not have intended it shouldn't deter you at all. There is definitely value to it... just wait until you get the first update from the vendor and can verify the existing API still works.

I've done the same sort of thing in C with CUnit.

Chris Arguin
A: 

I think it's complete OK what you are doing.

Unit Test with NUnit does not implement the rule that you must have code and don't allow to use a API.

Kovu