HI,
I have been assigned a task of exploring unit testing using tools available in the market. My question is how do i write an API that would help in writing unit test cases.
Example i can use nunit to write something like this to check whether file exists in the given location.
<Test()> _
Public Sub CheckOutputFileInfo()
ReportPath = "D:temp\test.txt"
Dim result As Boolean
result = File.Exists(ReportPath)
Assert.IsTrue(result)
End Sub
I understand this is not the best example but my question is how do i incorporate nunit and develop an API so that other developers/testers can write test cases without bothering about to learn about nunit.
FYI I have never written an API this will be my first shot at it.
Any recommendations on where to start??
thanks
Your example isn’t strictly a unit test as it hits the file system.
A test is not a unit test if:
I would advise you learn Unit Test best practices and patterns before starting to try to make your developers start unit testing. From experience someone needs to champion unit testing having fully grasped it themselves. It will save you a lot of headaches in the long run.
Here is an excellent book to get you started:
http://artofunittesting.com/