The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Software Testing >> Unit Testing

Pages: 1
ixora
Newbie


Reged: 03/08/11
Posts: 3
How to introduce Unit Testing
      #663520 - 03/08/11 06:19 PM

Hi,

Very recently I started my job as as QA Engineer and I have no previous experience in this field. I was assigned to design the Test Strategy for one of the company's product.
I've done some research and based on my reading, one of the best approach is to use unit testing, among other types of tests.

The problem is, when I talked to the developers, they admitted that they have never done unit testing before. They've tested their code, but not in the way of creating a test class for each class developed and testing each method one by one.

I had thought about introducing Unit Testing in the Test Strategy but I think the developers might not be too happy with it because the implementation of unit testing will double their workload.

Therefore I hope the members of this forum can help me on this. Should I insist on introducing Unit testing or is there another alternative to solve this problem?

For the info, I am the only QA Engineer here and previously they have no QA Engineer.


Post Extras: Print Post   Remind Me!   Notify Moderator  
eyp
Newbie


Reged: 03/16/11
Posts: 3
Re: How to introduce Unit Testing [Re: ixora]
      #664544 - 03/16/11 08:18 AM

Hello, I'm not a QA Engineer but a Software Architect & Developer so I would be at the developers side. You must explain them that doing unitary tests have a little workload at the beginning, but along the life of the system it will be less work for everyone.

They will have a better & realible code. If someone change something so a test is broken, they will be able to fix the issue before an incidence arrives.

Unit testing is part of any serious development process. I know It might be tedious for some developers to do unit tests, but they are rewarded when tests passes

Edited by eyp (03/16/11 08:19 AM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
AnandTambey
Advanced Member


Reged: 11/11/07
Posts: 647
Loc: India
Re: How to introduce Unit Testing [Re: eyp]
      #664639 - 03/17/11 12:34 AM

Do explain them about cost of fixing defects, where it increases when defect detected in later phases.

Earlier the defects caught less costly to fix it.

Unit testing skipped is serious flaw and cost stress/panic on every stakeholder down the road.

--------------------
Kind regards,
Anand Tambey

RSS Feed : Break To Make it Better
A Lazy person could be the best automation professional, if he is not lazy in implementing his ideas to reduce his work. ~Anand Tambey


Post Extras: Print Post   Remind Me!   Notify Moderator  
Shane_MacLaughlin
Super Member


Reged: 09/22/05
Posts: 1736
Loc: Dublin, Ireland
Re: How to introduce Unit Testing [Re: AnandTambey]
      #666014 - 03/28/11 03:59 AM

Quote:

Therefore I hope the members of this forum can help me on this. Should I insist on introducing Unit testing or is there another alternative to solve this problem?




This depends very much on the size and organisation of the existing code base. While it makes sense in most cases to introduce unit testing for most new projects in most modern programming languages, the same is not necessarily true of large existing legacy code bases. The reasons for this is that the amount of work may not return enough extra value added for the remaining life of the product. Adding unit tests to old code that you are not that familiar with is considerably more work than adding tests to new code as you write it, particularly if your programmers are not currently using or experienced with unit testing.

I'd tend to start with a comprehensive manual test of the product in question, and base my test strategy on the result. If the product is stable and not changing rapidly, I'd be more inclined to develop an automation suite covering typical usage scenarios which could be used for regression testing future releases. Parallel to this, get the developers to investigate unit testing tools and add unit tests to new code. Over time this can be augmented with additional unit tests covering important core functionality as required.

Unit testing is great, but it is not a silver bullet.

--------------------
My LinkedIn profile


Post Extras: Print Post   Remind Me!   Notify Moderator  
ixora
Newbie


Reged: 03/08/11
Posts: 3
Re: How to introduce Unit Testing [Re: Shane_MacLaughlin]
      #668020 - 04/13/11 08:58 PM

Thank you everyone for replying. Your explanation really help.

For clarification, the product is based on legacy code. Most work is done on customizing the product, which include module modification and some minor addition to the modules. The product is rather stable even though the frequency for code modification is on average 1-2 times per month.

I was thinking of telling the developer to add unit test on new code or modified code. So not all aspect of the legacy code will be covered in unit testing.

EDIT: The code for the product is quite huge.

What do you think about this?

Edited by ixora (04/13/11 08:59 PM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Shane_MacLaughlin
Super Member


Reged: 09/22/05
Posts: 1736
Loc: Dublin, Ireland
Re: How to introduce Unit Testing [Re: ixora]
      #668270 - 04/15/11 03:33 AM

Quote:

I was thinking of telling the developer to add unit test on new code or modified code. So not all aspect of the legacy code will be covered in unit testing.

EDIT: The code for the product is quite huge.

What do you think about this?




Sounds like a good plan, but I'd tend to augment it with some regression tests covering typical usage scenarios. The reason for this is that any modification to existing code, or any new code added that is used by existing code, is liable to have effects on other functional areas. These effects could include undesired results (yep, good ol' bugs).

Unit tests are typically designed to test the correctness of a given piece of code in isolation. They tend to miss problems that are combinatorial in nature where higher level system tests are not carried out, particularly so where unit test coverage is not comprehensive. e.g. just because I have tested units A,B and C does not imply that a program made up of solely those units will have no bugs, however much programmers try to convince you of the contrary. For this reason, testing the system as a whole by going through typical usage scenarios remains beneficial. Whether you do this manually, or consider automation is a different discussion. This thread might be worth a read in this regard.

--------------------
My LinkedIn profile


Post Extras: Print Post   Remind Me!   Notify Moderator  
dlai
Junior Member


Reged: 05/02/06
Posts: 1041
Loc: CA, USA
Re: How to introduce Unit Testing [Re: ixora]
      #689774 - 10/27/11 09:37 AM

I think it's great you want to introduce unit tests. I personally think this is very important. Here are supporting points.. Hopefully you can share this and get bigger buy in on unit testing.

1) Unit tests are proven to be one of the most effective in terms of time to fix the bug. Not only does it identify the exact problem, it'll usually expose the function the bug is happening in.

2) In terms of return on investment, Unit test is the most effective of all automated tests. It represents the bottom layer of Cohn's testing pyramid. According to Cohn, unit tests should compose of 70% of all the automated testing.

3) Unit tests promote good code design. In my experience, when I find it troublesome to unit test a piece of code I'm writing, it's usually because of bad design to begin with. Problems like tight coupling and unnecessary dependencies are exposed when writing unit tests. These types of problems become painful later on during refactoring.

4) Unit tests are easy to run in continuous integration and provide instant feedback. Buts can be fixed before they need to be reported.

5) It is easier to run code coverage tools in unit testing. And it's easier to hit pieces of code, such as redundant error handling routines and exception scenarios.

6) Unit tests helps new developers understand the code. They see usage examples of the how the code is called in isolation, along with their expected outcomes. It provides valueable coding examples for Junior developers.

--------------------
David Lai
Sr. QA / Test Lead
LinkedIn profile


Post Extras: Print Post   Remind Me!   Notify Moderator  
Anderson7
Newbie


Reged: 02/21/12
Posts: 3
Re: How to introduce Unit Testing [Re: dlai]
      #699063 - 02/21/12 02:55 AM

Unit Testing is a mtthod by which individual units of source code are tested to determine i tehu are fit for use.
A unit is a small part of a application it may be a individual function or procedure. In OOPs, a unit may be a class.
Unit test are created by the programmers by white box testers during the development process.

--------------------
Windows Driver Update
Virus Removal


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 5 anonymous users are browsing this forum.

Moderator:  AJ, Jeanj 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 7604

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5