Hi folks!
This article is about unit testing in responsibility of QA engineer. As we know – exists different type of testing: unit (module), component, integration etc. Generally  – coverage of code by unit tests is developer’s responsibility. Because for developer it’s easy to do. He knows how some method was implemented and what need to verify here. But in this case a lot different edge-cases could be missed. That’s why now is existing some tendency that test engineers should covers the code by unit tests. Here are some benefits: test engineer will be read each line of the code and can find some gap where not implemented exception or something like this. Test engineer knows a different technique of testing, like boundary values etc. Test engineer will think how to implement DDT in TDD.
Ok, let’s think that You are assigned to the project and You need to do something like this. How to start and what You need to know.

  1. What framework for Unit testing is used. Is it JUnit or TestNG for JAVA.  NUnit or MSTest for C#?
  2. You need to think how much data You need to cover some functionality. You need to know this for choosing format of data saving. If it should be a lot of data for 1 test – better to save it in some *.xsl or *.csv files. If it should be a data for a lot of different tests – better to collect everything in *.xml or json format. Much easier to read file for people (from my perspective)
  3. You can divide the test classes by some logic or better – it’s to have separate test classes for each of classes in application.
  4. As QA – You need to find all the gaps in the code. You need to find where can happens unexpected exceptions and need to cover it.
  5. Remember – that unit test should cover only one unit, not 1 big method, which contains calls to a lot of small methods.
  6. Cover by unit tests everything. Even if You are thinking that here can not be error. Better to cover everything than catch unexpected error on production.
  7. Don’t scare to ask developers if You don’t understand something.

Here are a few useful link which You can read to understand, what You need to do. EasyTest, TestNG (DataProvider).

Thanks to all! And have a good testing!