what is unit testing? It comes under white box or Black Box
testing?

Answer Posted / sylesh

I think it depends on how you define the so called 'unit'.
Consider a situation where you wrote an application with
just one functionality, which is implemented in precisely
one function. Assume this function contains 3 logical
blocks of code, say an if..else, a for loop and then
another block of statements.

If we are to say that a white box testing has been done on
that code, we should have tested each of these different
blocks of statements, ensure coverage by carrying out
various and as many tests required by inputting as many
varied parameters to ensure that the execution of code has
been tested through each of the lines / blocks of code.

Same time, the programmer would have tested the function
just by passing the input parameters as specified / assumed
from the functionality of the application and would have
verified whether the output has come right.

So if we consider the unit under consideration to be a
function then I think the so called unit test in that case
should be considered more close to black box where as if
the programmer has catered for complete coverage
considering each and every line of code, it should be
considered white box.

Obviously white box testing is more fail safe but sometimes
programmers end up writing unit test cases just for public
functions in which case I prefer to say it is close to
black box.

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between a bug, a defect and an error?

674


How to test an application if it was already developed and it is in the state of changing the functionality according to the customer requirement How to start testing in this situation. I got an application to test.It is a desktop application.It is still developing and started 8 months back.how can i start to test this application? Is it the right way to test it in "Random testing"? or writing the testcases from page one and executing them.i have an another responsibility that is I have to automate that application. can anyone tell me what is the process to test this application.

1546


Why testers wil prepare useracceptance testcases,system testcases and integration testcases,What is the differenece between all this test cases

1599


i have source and target having same data structure 500 fields and one lacks records. how to validate data. write 5 scenarios.

4786


What is the negative testing and example

980






What is Difference between Test Strategy and Test Methodology?

1719


Which testing model is best as per your understanding, and why?

705


HOW TO CREATE SRS REVIEW REPORT TO PL?

1896


What is Wound Fixing?

1868


What is the test case?

636


How can data caching have a negative effect on load testing results?

2362


How to test the Online Games?? Suggest tricks. I have experience in server-client application testing.

1438


how can we do database testing. In database testing we verify the data integrity and data validation. how can we do testing of Index, triggers, views, ransactions,cursors etc

1466


How do u go about testing of web application?

1631


How will you determine when to stop testing?

620