Diff between unit and functional test case
What is the different between a Unit and Functional Test Case?
Re: Diff between unit and functional test case
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by somasundaram:
What is the different between a Unit and Functional Test Case?<HR></BLOCKQUOTE>
The difference depends on how one defines the terms. In general, of course, a test case is simply input, action, output along with a set of expected results for you to compare against. Some people define a "unit" at the code-level and, in this case, your unit test cases might be a little more granular in terms of how they describe what is being tested. For example you might say (putting it into plain words here): "The method PopulationValues() should be tested sending it one parameter, two parameters, no parameters, and invalid parameters." (There is a lot more to be said here; I am just giving a general example.) A "functional test case" tends to be more high-level in the sense that it does not talk about specific code areas of the application but more about specific areas of functionality. So, for example, if the application had a data grid with a command button that said "Fill Grid" (which calls the PopulateValues() method) you would probably have a test case that says "Go to such-and-such a screen and press the Fill Grid button." There might be other conditions you put on this so, again, I am giving very simple examples here.
For a more specific example of a unit test case, let us say that you have the following requirement or statement for a hypothetical CalculateValue() method: "When given an input of less than 0, the error message 'illegal negative input' shall be displayed and a value of 0 returned. The method Print_Line() shall be used to display the error message."
You thus have a unit test case that specifies the input (say, -5) an action (which is defined by the CalculateValue() method) and expected output: "illegal negative input". You can now test if that happens and, since this is at the unit (code) level, you can test if the message was generated via the Print_Line(). Note that a functional test case would not check the Print_Line() method specifically because that is at the code level but this message is presumably displayed to a user (perhaps in a dialog box or something) so the functional test would check for the message when a negative value is entered. Do you see what is happening here? Both test cases can be checking the same functionality, but what you are specifically looking for in each test case is slightly different in terms of granularity. (The functional test case cares more about the message that is delivered and that it is delivered only when negative inputs are made. The unit test case is more concerned with how the message is delivered and how it was called.)