<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ird</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ird"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ird"/>
	<updated>2026-05-29T18:47:25Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26731</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26731"/>
		<updated>2009-11-13T00:11:19Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* When and how NOT to use assertions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validates correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They are also a very useful tool to detect logical errors. For e.g consider the following code&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. &lt;br /&gt;
&lt;br /&gt;
Numerous other run-time checks can be made. The following example illustrates that&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an Internal invariant. The latter means that even though its obvious that the result would be 3, we eliminate any logical errors by asserting that.&lt;br /&gt;
&lt;br /&gt;
== Programming languages supporting native assertions ==&lt;br /&gt;
&lt;br /&gt;
The following programming languages support assertions natively&amp;lt;sup&amp;gt;[2]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* Cobra&lt;br /&gt;
* D&lt;br /&gt;
* Eiffel&lt;br /&gt;
* Fortress&lt;br /&gt;
* Lisaac&lt;br /&gt;
* Nice&lt;br /&gt;
* Oxygene (formerly Chrome)&lt;br /&gt;
* Sather&lt;br /&gt;
* SPARK, via static analysis of Ada programs&lt;br /&gt;
* Spec#&lt;br /&gt;
&lt;br /&gt;
== Advantages and disadvantages of assertions ==&lt;br /&gt;
&lt;br /&gt;
Some programming languages natively support assertions (mentioned above) while some support through add-ins (like C/C++, C#, Java, Javascript etc.). However, most of the above listed languages are high level languages with less popularity. Hence the need for supporting assertions in the commonly used languages is important. &lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
There are many advantages of assertions. Some of them are enumerated here&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* they remove the need for ''passive assertions'' (in the form of comments) and instead actively assert the condition and fail if false during run-time: comments may outlive the code and may not hold for the new code. They act like passive assertions, so its the programmer who has to take care of the condition. In case of ''assert'' statements, they enforce the conditions and never outlive the code. If the code changes, the assert statement has to change too, for the program to execute. They thus act as ''active'' snippets of comments.&lt;br /&gt;
&lt;br /&gt;
* they make you more confident of your code: The programmer makes a certain assumptions during the coding phase. Assertions validate the programmer's assumptions. If any of them turns out to be false, code without assertions may execute and show unexpected behavior. ''Assertions'' avoid such situations and make the code less buggy.&lt;br /&gt;
&lt;br /&gt;
* they help refactor the code: Whenever somebody's refactoring the code, leaving the assertions in place (or modifying them accordingly) ensures that the logic is not flawed and the refactor was actually done (without altering the logic). It is a way to validate the process of refactoring. The same hold true for optimization. Assertions ensure that while in the process, the program logic was not altered.&lt;br /&gt;
&lt;br /&gt;
*  they act as embedded tests: A very good example is the development of Program 1: MeToo. A lot of assertions were used in the unit tests. Assertions are like small tests embedded within the code. They simplify the testing of the code.&lt;br /&gt;
&lt;br /&gt;
* they help in debugging: When a program has assertions, it is easy to narrow down the error since the programmer now knows that if there is an assertion error then the problem must be somewhere in the vicinity of the assertion. They thus help in efficient debugging.&lt;br /&gt;
&lt;br /&gt;
* they support Programming by Contract: Assertions help establish a relationship between a class and its consumers. It defines what rights does an element have and what is it supposed or capable of doing.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
There are some disadvantages to using assertions too. However, the advantages outnumber the disadvantages. Some of the disadvantages are listed below:&lt;br /&gt;
&lt;br /&gt;
* the biggest disadvantage is probably the speed: Code with a lot of assertions is slower than one without assertions. However, it can be argued that during development its the accuracy and correctness that is utmost important and thus speed can be sacrificed at the cost of correctness/accuracy&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* assertions can be tricky to write: Unless the programmer puts down his/her assumptions in the form of assertions accurately, they serve no purpose. &lt;br /&gt;
&lt;br /&gt;
* assertions can cause dependency problems: A class may be heavily dependent on every assert class in it. Thus extension maybe a problem&lt;br /&gt;
&lt;br /&gt;
* stimulus must make use of assertions: Extensive and exhaustive testing is still required. The test-suite (or the stimulus) must make use of all the assertions for them to show their benefit. If the stimulus never tests some special corner cases, those assertions will never fire up to trigger an error&amp;lt;sup&amp;gt;[5]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== When ''NOT'' to use assertions ==&lt;br /&gt;
&lt;br /&gt;
If used incorrectly assertions can be a bane and can significantly alter the program flow&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assert((var = a*3*0.45*i) != 0);&lt;br /&gt;
var1 = var2/var;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem with the above code is that the expression is evaluated inside the assert statement. Most languages have a feature to disable assertions. What if assertions are disabled? ''var'' would never be correctly evaluated and some garbage value maybe passed on to the next statement. If ''var'' is passed on as '0', then the program would generate a 'Divide by zero' exception. A fix to that problem would be to separate the expression evaluation and then assert. The following code shows the fix:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var = (a*3*0.45*i);&lt;br /&gt;
assert(var != 0);&lt;br /&gt;
var1 = var2/var;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus one must be careful when using the assert statements.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html&lt;br /&gt;
# http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
# http://www.stanford.edu/~pgbovine/programming-with-asserts.htm&lt;br /&gt;
# http://courses.csail.mit.edu/6.170/old-www/2002-Fall/lectures/lecture-10.pdf&lt;br /&gt;
# http://www.esperan.com/pdf/esperan_introduction_to_psl.pdf&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26640</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26640"/>
		<updated>2009-11-11T01:32:38Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* When and how NOT to use assertions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validates correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They are also a very useful tool to detect logical errors. For e.g consider the following code&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. &lt;br /&gt;
&lt;br /&gt;
Numerous other run-time checks can be made. The following example illustrates that&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an Internal invariant. The latter means that even though its obvious that the result would be 3, we eliminate any logical errors by asserting that.&lt;br /&gt;
&lt;br /&gt;
== Programming languages supporting native assertions ==&lt;br /&gt;
&lt;br /&gt;
The following programming languages support assertions natively&amp;lt;sup&amp;gt;[2]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* Cobra&lt;br /&gt;
* D&lt;br /&gt;
* Eiffel&lt;br /&gt;
* Fortress&lt;br /&gt;
* Lisaac&lt;br /&gt;
* Nice&lt;br /&gt;
* Oxygene (formerly Chrome)&lt;br /&gt;
* Sather&lt;br /&gt;
* SPARK, via static analysis of Ada programs&lt;br /&gt;
* Spec#&lt;br /&gt;
&lt;br /&gt;
== Advantages and disadvantages of assertions ==&lt;br /&gt;
&lt;br /&gt;
Some programming languages natively support assertions (mentioned above) while some support through add-ins (like C/C++, C#, Java, Javascript etc.). However, most of the above listed languages are high level languages with less popularity. Hence the need for supporting assertions in the commonly used languages is important. &lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
There are many advantages of assertions. Some of them are enumerated here&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* they remove the need for ''passive assertions'' (in the form of comments) and instead actively assert the condition and fail if false during run-time: comments may outlive the code and may not hold for the new code. They act like passive assertions, so its the programmer who has to take care of the condition. In case of ''assert'' statements, they enforce the conditions and never outlive the code. If the code changes, the assert statement has to change too, for the program to execute. They thus act as ''active'' snippets of comments.&lt;br /&gt;
&lt;br /&gt;
* they make you more confident of your code: The programmer makes a certain assumptions during the coding phase. Assertions validate the programmer's assumptions. If any of them turns out to be false, code without assertions may execute and show unexpected behavior. ''Assertions'' avoid such situations and make the code less buggy.&lt;br /&gt;
&lt;br /&gt;
* they help refactor the code: Whenever somebody's refactoring the code, leaving the assertions in place (or modifying them accordingly) ensures that the logic is not flawed and the refactor was actually done (without altering the logic). It is a way to validate the process of refactoring. The same hold true for optimization. Assertions ensure that while in the process, the program logic was not altered.&lt;br /&gt;
&lt;br /&gt;
*  they act as embedded tests: A very good example is the development of Program 1: MeToo. A lot of assertions were used in the unit tests. Assertions are like small tests embedded within the code. They simplify the testing of the code.&lt;br /&gt;
&lt;br /&gt;
* they help in debugging: When a program has assertions, it is easy to narrow down the error since the programmer now knows that if there is an assertion error then the problem must be somewhere in the vicinity of the assertion. They thus help in efficient debugging.&lt;br /&gt;
&lt;br /&gt;
* they support Programming by Contract: Assertions help establish a relationship between a class and its consumers. It defines what rights does an element have and what is it supposed or capable of doing.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
There are some disadvantages to using assertions too. However, the advantages outnumber the disadvantages. Some of the disadvantages are listed below:&lt;br /&gt;
&lt;br /&gt;
* the biggest disadvantage is probably the speed: Code with a lot of assertions is slower than one without assertions. However, it can be argued that during development its the accuracy and correctness that is utmost important and thus speed can be sacrificed at the cost of correctness/accuracy&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* assertions can be tricky to write: Unless the programmer puts down his/her assumptions in the form of assertions accurately, they serve no purpose. &lt;br /&gt;
&lt;br /&gt;
* assertions can cause dependency problems: A class may be heavily dependent on every assert class in it. Thus extension maybe a problem&lt;br /&gt;
&lt;br /&gt;
* stimulus must make use of assertions: Extensive and exhaustive testing is still required. The test-suite (or the stimulus) must make use of all the assertions for them to show their benefit. If the stimulus never tests some special corner cases, those assertions will never fire up to trigger an error&amp;lt;sup&amp;gt;[5]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== When and how NOT to use assertions ==&lt;br /&gt;
&lt;br /&gt;
If used incorrectly assertions can be a bane and can significantly alter the program flow&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assert((var = a*3*0.45*i) != 0);&lt;br /&gt;
var1 = var2/var;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem with the above code is that the expression is evaluated inside the assert statement. Most languages have a feature to disable assertions. What if assertions are disabled? ''var'' would never be correctly evaluated and some garbage value maybe passed on to the next statement. If ''var'' is passed on as '0', then the program would generate a 'Divide by zero' exception. A fix to that problem would be to separate the expression evaluation and then assert. The following code shows the fix:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var = (a*3*0.45*i);&lt;br /&gt;
assert(var != 0);&lt;br /&gt;
var1 = var2/var;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus one must be careful when using the assert statements.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html&lt;br /&gt;
# http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
# http://www.stanford.edu/~pgbovine/programming-with-asserts.htm&lt;br /&gt;
# http://courses.csail.mit.edu/6.170/old-www/2002-Fall/lectures/lecture-10.pdf&lt;br /&gt;
# http://www.esperan.com/pdf/esperan_introduction_to_psl.pdf&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26639</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26639"/>
		<updated>2009-11-11T01:30:38Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* When and how NOT to use assertions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validates correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They are also a very useful tool to detect logical errors. For e.g consider the following code&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. &lt;br /&gt;
&lt;br /&gt;
Numerous other run-time checks can be made. The following example illustrates that&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an Internal invariant. The latter means that even though its obvious that the result would be 3, we eliminate any logical errors by asserting that.&lt;br /&gt;
&lt;br /&gt;
== Programming languages supporting native assertions ==&lt;br /&gt;
&lt;br /&gt;
The following programming languages support assertions natively&amp;lt;sup&amp;gt;[2]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* Cobra&lt;br /&gt;
* D&lt;br /&gt;
* Eiffel&lt;br /&gt;
* Fortress&lt;br /&gt;
* Lisaac&lt;br /&gt;
* Nice&lt;br /&gt;
* Oxygene (formerly Chrome)&lt;br /&gt;
* Sather&lt;br /&gt;
* SPARK, via static analysis of Ada programs&lt;br /&gt;
* Spec#&lt;br /&gt;
&lt;br /&gt;
== Advantages and disadvantages of assertions ==&lt;br /&gt;
&lt;br /&gt;
Some programming languages natively support assertions (mentioned above) while some support through add-ins (like C/C++, C#, Java, Javascript etc.). However, most of the above listed languages are high level languages with less popularity. Hence the need for supporting assertions in the commonly used languages is important. &lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
There are many advantages of assertions. Some of them are enumerated here&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* they remove the need for ''passive assertions'' (in the form of comments) and instead actively assert the condition and fail if false during run-time: comments may outlive the code and may not hold for the new code. They act like passive assertions, so its the programmer who has to take care of the condition. In case of ''assert'' statements, they enforce the conditions and never outlive the code. If the code changes, the assert statement has to change too, for the program to execute. They thus act as ''active'' snippets of comments.&lt;br /&gt;
&lt;br /&gt;
* they make you more confident of your code: The programmer makes a certain assumptions during the coding phase. Assertions validate the programmer's assumptions. If any of them turns out to be false, code without assertions may execute and show unexpected behavior. ''Assertions'' avoid such situations and make the code less buggy.&lt;br /&gt;
&lt;br /&gt;
* they help refactor the code: Whenever somebody's refactoring the code, leaving the assertions in place (or modifying them accordingly) ensures that the logic is not flawed and the refactor was actually done (without altering the logic). It is a way to validate the process of refactoring. The same hold true for optimization. Assertions ensure that while in the process, the program logic was not altered.&lt;br /&gt;
&lt;br /&gt;
*  they act as embedded tests: A very good example is the development of Program 1: MeToo. A lot of assertions were used in the unit tests. Assertions are like small tests embedded within the code. They simplify the testing of the code.&lt;br /&gt;
&lt;br /&gt;
* they help in debugging: When a program has assertions, it is easy to narrow down the error since the programmer now knows that if there is an assertion error then the problem must be somewhere in the vicinity of the assertion. They thus help in efficient debugging.&lt;br /&gt;
&lt;br /&gt;
* they support Programming by Contract: Assertions help establish a relationship between a class and its consumers. It defines what rights does an element have and what is it supposed or capable of doing.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
There are some disadvantages to using assertions too. However, the advantages outnumber the disadvantages. Some of the disadvantages are listed below:&lt;br /&gt;
&lt;br /&gt;
* the biggest disadvantage is probably the speed: Code with a lot of assertions is slower than one without assertions. However, it can be argued that during development its the accuracy and correctness that is utmost important and thus speed can be sacrificed at the cost of correctness/accuracy&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* assertions can be tricky to write: Unless the programmer puts down his/her assumptions in the form of assertions accurately, they serve no purpose. &lt;br /&gt;
&lt;br /&gt;
* assertions can cause dependency problems: A class may be heavily dependent on every assert class in it. Thus extension maybe a problem&lt;br /&gt;
&lt;br /&gt;
* stimulus must make use of assertions: Extensive and exhaustive testing is still required. The test-suite (or the stimulus) must make use of all the assertions for them to show their benefit. If the stimulus never tests some special corner cases, those assertions will never fire up to trigger an error&amp;lt;sup&amp;gt;[5]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== When and how NOT to use assertions ==&lt;br /&gt;
&lt;br /&gt;
If used incorrectly assertions can be a bane and can significantly alter the program flow&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
assert((var = a*3*0.45*i) != 0);&lt;br /&gt;
var1 = var2/var;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem with the above code is that the expression is evaluated inside the assert statement. Most languages have a feature to disable assertions. What if assertions are disabled? ''var'' would never be correctly evaluated and some garbage value maybe passed on to the next statement. If ''var'' is passed on as '0', then the program would generate a 'Divide by zero' exception. A fix to that problem would be to separate the expression evaluation and then assert. The following code shows the fix:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
var = (a*3*0.45*i);&lt;br /&gt;
assert(var != 0);&lt;br /&gt;
var1 = var2/var;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus one must be careful when using the assert statements.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html&lt;br /&gt;
# http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
# http://www.stanford.edu/~pgbovine/programming-with-asserts.htm&lt;br /&gt;
# http://courses.csail.mit.edu/6.170/old-www/2002-Fall/lectures/lecture-10.pdf&lt;br /&gt;
# http://www.esperan.com/pdf/esperan_introduction_to_psl.pdf&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26638</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26638"/>
		<updated>2009-11-11T01:29:18Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validates correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They are also a very useful tool to detect logical errors. For e.g consider the following code&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. &lt;br /&gt;
&lt;br /&gt;
Numerous other run-time checks can be made. The following example illustrates that&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an Internal invariant. The latter means that even though its obvious that the result would be 3, we eliminate any logical errors by asserting that.&lt;br /&gt;
&lt;br /&gt;
== Programming languages supporting native assertions ==&lt;br /&gt;
&lt;br /&gt;
The following programming languages support assertions natively&amp;lt;sup&amp;gt;[2]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* Cobra&lt;br /&gt;
* D&lt;br /&gt;
* Eiffel&lt;br /&gt;
* Fortress&lt;br /&gt;
* Lisaac&lt;br /&gt;
* Nice&lt;br /&gt;
* Oxygene (formerly Chrome)&lt;br /&gt;
* Sather&lt;br /&gt;
* SPARK, via static analysis of Ada programs&lt;br /&gt;
* Spec#&lt;br /&gt;
&lt;br /&gt;
== Advantages and disadvantages of assertions ==&lt;br /&gt;
&lt;br /&gt;
Some programming languages natively support assertions (mentioned above) while some support through add-ins (like C/C++, C#, Java, Javascript etc.). However, most of the above listed languages are high level languages with less popularity. Hence the need for supporting assertions in the commonly used languages is important. &lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
There are many advantages of assertions. Some of them are enumerated here&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* they remove the need for ''passive assertions'' (in the form of comments) and instead actively assert the condition and fail if false during run-time: comments may outlive the code and may not hold for the new code. They act like passive assertions, so its the programmer who has to take care of the condition. In case of ''assert'' statements, they enforce the conditions and never outlive the code. If the code changes, the assert statement has to change too, for the program to execute. They thus act as ''active'' snippets of comments.&lt;br /&gt;
&lt;br /&gt;
* they make you more confident of your code: The programmer makes a certain assumptions during the coding phase. Assertions validate the programmer's assumptions. If any of them turns out to be false, code without assertions may execute and show unexpected behavior. ''Assertions'' avoid such situations and make the code less buggy.&lt;br /&gt;
&lt;br /&gt;
* they help refactor the code: Whenever somebody's refactoring the code, leaving the assertions in place (or modifying them accordingly) ensures that the logic is not flawed and the refactor was actually done (without altering the logic). It is a way to validate the process of refactoring. The same hold true for optimization. Assertions ensure that while in the process, the program logic was not altered.&lt;br /&gt;
&lt;br /&gt;
*  they act as embedded tests: A very good example is the development of Program 1: MeToo. A lot of assertions were used in the unit tests. Assertions are like small tests embedded within the code. They simplify the testing of the code.&lt;br /&gt;
&lt;br /&gt;
* they help in debugging: When a program has assertions, it is easy to narrow down the error since the programmer now knows that if there is an assertion error then the problem must be somewhere in the vicinity of the assertion. They thus help in efficient debugging.&lt;br /&gt;
&lt;br /&gt;
* they support Programming by Contract: Assertions help establish a relationship between a class and its consumers. It defines what rights does an element have and what is it supposed or capable of doing.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
There are some disadvantages to using assertions too. However, the advantages outnumber the disadvantages. Some of the disadvantages are listed below:&lt;br /&gt;
&lt;br /&gt;
* the biggest disadvantage is probably the speed: Code with a lot of assertions is slower than one without assertions. However, it can be argued that during development its the accuracy and correctness that is utmost important and thus speed can be sacrificed at the cost of correctness/accuracy&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* assertions can be tricky to write: Unless the programmer puts down his/her assumptions in the form of assertions accurately, they serve no purpose. &lt;br /&gt;
&lt;br /&gt;
* assertions can cause dependency problems: A class may be heavily dependent on every assert class in it. Thus extension maybe a problem&lt;br /&gt;
&lt;br /&gt;
* stimulus must make use of assertions: Extensive and exhaustive testing is still required. The test-suite (or the stimulus) must make use of all the assertions for them to show their benefit. If the stimulus never tests some special corner cases, those assertions will never fire up to trigger an error&amp;lt;sup&amp;gt;[5]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== When and how NOT to use assertions ==&lt;br /&gt;
&lt;br /&gt;
If used incorrectly assertions can be a bane and can significantly alter the program flow&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
assert((var = a*3*0.45*i) != 0);&lt;br /&gt;
var1 = var2/var;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem with the above code is that the expression is evaluated inside the assert statement. Most languages have a feature to disable assertions. What if assertions are disabled? ''var'' would never be correctly evaluated and some garbage value maybe passed on to the next statement. If ''var'' is passed on as '0', then the program would generate a 'Divide by zero' exception. A fix to that problem would be to separate the expression evaluation and then assert. The following code shows the fix:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
var = (a*3*0.45*i);&lt;br /&gt;
assert(var != 0);&lt;br /&gt;
var1 = var2/var;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html&lt;br /&gt;
# http://en.wikipedia.org/wiki/Design_by_contract&lt;br /&gt;
# http://www.stanford.edu/~pgbovine/programming-with-asserts.htm&lt;br /&gt;
# http://courses.csail.mit.edu/6.170/old-www/2002-Fall/lectures/lecture-10.pdf&lt;br /&gt;
# http://www.esperan.com/pdf/esperan_introduction_to_psl.pdf&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26637</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26637"/>
		<updated>2009-11-11T01:24:09Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validates correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They are also a very useful tool to detect logical errors. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. &lt;br /&gt;
&lt;br /&gt;
Numerous other run-time checks can be made. The following example illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an Internal invariant. The latter means that even though its obvious that the result would be 3, we eliminate any logical errors by asserting that.&lt;br /&gt;
&lt;br /&gt;
== Programming languages supporting native assertions ==&lt;br /&gt;
&lt;br /&gt;
The following programming languages support assertions natively:&lt;br /&gt;
&lt;br /&gt;
* Cobra&lt;br /&gt;
* D&lt;br /&gt;
* Eiffel&lt;br /&gt;
* Fortress&lt;br /&gt;
* Lisaac&lt;br /&gt;
* Nice&lt;br /&gt;
* Oxygene (formerly Chrome)&lt;br /&gt;
* Sather&lt;br /&gt;
* SPARK, via static analysis of Ada programs&lt;br /&gt;
* Spec#&lt;br /&gt;
&lt;br /&gt;
== Advantages and disadvantages of assertions ==&lt;br /&gt;
&lt;br /&gt;
Some programming languages natively support assertions (mentioned above) while some support through add-ins (like C/C++, C#, Java, Javascript etc.). However, most of the above listed languages are high level languages with less popularity. Hence the need for supporting assertions in the commonly used languages is important. &lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
There are many advantages of assertions. Some of them are enumerated here:&lt;br /&gt;
&lt;br /&gt;
* they remove the need for ''passive assertions'' (in the form of comments) and instead actively assert the condition and fail if false during run-time: comments may outlive the code and may not hold for the new code. They act like passive assertions, so its the programmer who has to take care of the condition. In case of ''assert'' statements, they enforce the conditions and never outlive the code. If the code changes, the assert statement has to change too, for the program to execute. They thus act as ''active'' snippets of comments.&lt;br /&gt;
&lt;br /&gt;
* they make you more confident of your code: The programmer makes a certain assumptions during the coding phase. Assertions validate the programmer's assumptions. If any of them turns out to be false, code without assertions may execute and show unexpected behavior. ''Assertions'' avoid such situations and make the code less buggy.&lt;br /&gt;
&lt;br /&gt;
* they help refactor the code: Whenever somebody's refactoring the code, leaving the assertions in place (or modifying them accordingly) ensures that the logic is not flawed and the refactor was actually done (without altering the logic). It is a way to validate the process of refactoring. The same hold true for optimization. Assertions ensure that while in the process, the program logic was not altered.&lt;br /&gt;
&lt;br /&gt;
*  they act as embedded tests: A very good example is the development of Program 1: MeToo. A lot of assertions were used in the unit tests. Assertions are like small tests embedded within the code. They simplify the testing of the code.&lt;br /&gt;
&lt;br /&gt;
* they help in debugging: When a program has assertions, it is easy to narrow down the error since the programmer now knows that if there is an assertion error then the problem must be somewhere in the vicinity of the assertion. They thus help in efficient debugging.&lt;br /&gt;
&lt;br /&gt;
* they support Programming by Contract: Assertions help establish a relationship between a class and its consumers. It defines what rights does an element have and what is it supposed or capable of doing.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
There are some disadvantages to using assertions too. However, the advantages outnumber the disadvantages. Some of the disadvantages are listed below:&lt;br /&gt;
&lt;br /&gt;
* the biggest disadvantage is probably the speed: Code with a lot of assertions is slower than one without assertions. However, it can be argued that during development its the accuracy and correctness that is utmost important and thus speed can be sacrificed at the cost of correctness/accuracy.&lt;br /&gt;
&lt;br /&gt;
* assertions can be tricky to write: Unless the programmer puts down his/her assumptions in the form of assertions accurately, they serve no purpose. &lt;br /&gt;
&lt;br /&gt;
* assertions can cause dependency problems: A class may be heavily dependent on every assert class in it. Thus extension maybe a problem&lt;br /&gt;
&lt;br /&gt;
* stimulus must make use of assertions: Extensive and exhaustive testing is still required. The test-suite (or the stimulus) must make use of all the assertions for them to show their benefit. If the stimulus never tests some special corner cases, those assertions will never fire up to trigger an error.&lt;br /&gt;
&lt;br /&gt;
== When and how NOT to use assertions ==&lt;br /&gt;
&lt;br /&gt;
If used incorrectly assertions can be a bane and can significantly alter the program flow. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
assert((var = a*3*0.45*i) != 0);&lt;br /&gt;
var1 = var2/var;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem with the above code is that the expression is evaluated inside the assert statement. Most languages have a feature to disable assertions. What if assertions are disabled? ''var'' would never be correctly evaluated and some garbage value maybe passed on to the next statement. If ''var'' is passed on as '0', then the program would generate a 'Divide by zero' exception. A fix to that problem would be to separate the expression evaluation and then assert. The following code shows the fix:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
var = (a*3*0.45*i);&lt;br /&gt;
assert(var != 0);&lt;br /&gt;
var1 = var2/var;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26636</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26636"/>
		<updated>2009-11-11T01:04:43Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validates correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They are also a very useful tool to detect logical errors. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. &lt;br /&gt;
&lt;br /&gt;
Numerous other run-time checks can be made. The following example illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an Internal invariant. The latter means that even though its obvious that the result would be 3, we eliminate any logical errors by asserting that.&lt;br /&gt;
&lt;br /&gt;
== Programming languages supporting native assertions ==&lt;br /&gt;
&lt;br /&gt;
The following programming languages support assertions natively:&lt;br /&gt;
&lt;br /&gt;
* Cobra&lt;br /&gt;
* D&lt;br /&gt;
* Eiffel&lt;br /&gt;
* Fortress&lt;br /&gt;
* Lisaac&lt;br /&gt;
* Nice&lt;br /&gt;
* Oxygene (formerly Chrome)&lt;br /&gt;
* Sather&lt;br /&gt;
* SPARK, via static analysis of Ada programs&lt;br /&gt;
* Spec#&lt;br /&gt;
&lt;br /&gt;
== Advantages and disadvantages of assertions ==&lt;br /&gt;
&lt;br /&gt;
Some programming languages natively support assertions (mentioned above) while some support through add-ins (like C/C++, C#, Java, Javascript etc.). However, most of the above listed languages are high level languages with less popularity. Hence the need for supporting assertions in the commonly used languages is important. &lt;br /&gt;
&lt;br /&gt;
There are many advantages of assertions. Some of them are enumerated here:&lt;br /&gt;
&lt;br /&gt;
* they remove the need for ''passive assertions'' (in the form of comments) and instead actively assert the condition and fail if false during run-time: comments may outlive the code and may not hold for the new code. They act like passive assertions, so its the programmer who has to take care of the condition. In case of ''assert'' statements, they enforce the conditions and never outlive the code. If the code changes, the assert statement has to change too, for the program to execute. They thus act as ''active'' snippets of comments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* they make you more confident of your code: The programmer makes a certain assumptions during the coding phase. Assertions validate the programmer's assumptions. If any of them turns out to be false, code without assertions may execute and show unexpected behavior. ''Assertions'' avoid such situations and make the code less buggy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* they help refactor the code: Whenever somebody's refactoring the code, leaving the assertions in place (or modifying them accordingly) ensures that the logic is not flawed and the refactor was actually done (without altering the logic). It is a way to validate the process of refactoring. The same hold true for optimization. Assertions ensure that while in the process, the program logic was not altered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*  they act as embedded tests: A very good example is the development of Program 1: MeToo. A lot of assertions were used in the unit tests. Assertions are like small tests embedded within the code. They simplify the testing of the code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* they help in debugging: When a program has assertions, it is easy to narrow down the error since the programmer now knows that if there is an assertion error then the problem must be somewhere in the vicinity of the assertion. They thus help in efficient debugging.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26635</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26635"/>
		<updated>2009-11-11T01:02:18Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validates correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They are also a very useful tool to detect logical errors. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. &lt;br /&gt;
&lt;br /&gt;
Numerous other run-time checks can be made. The following example illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an Internal invariant. The latter means that even though its obvious that the result would be 3, we eliminate any logical errors by asserting that.&lt;br /&gt;
&lt;br /&gt;
== Programming languages supporting native assertions ==&lt;br /&gt;
&lt;br /&gt;
The following programming languages support assertions natively:&lt;br /&gt;
&lt;br /&gt;
* Cobra&lt;br /&gt;
* D&lt;br /&gt;
* Eiffel&lt;br /&gt;
* Fortress&lt;br /&gt;
* Lisaac&lt;br /&gt;
* Nice&lt;br /&gt;
* Oxygene (formerly Chrome)&lt;br /&gt;
* Sather&lt;br /&gt;
* SPARK, via static analysis of Ada programs&lt;br /&gt;
* Spec#&lt;br /&gt;
&lt;br /&gt;
== Advantages and disadvantages of assertions ==&lt;br /&gt;
&lt;br /&gt;
Some programming languages natively support assertions (mentioned above) while some support through add-ins (like C/C++, C#, Java, Javascript etc.). However, most of the above listed languages are high level languages with less popularity. Hence the need for supporting assertions in the commonly used languages is important. &lt;br /&gt;
&lt;br /&gt;
There are many advantages of assertions. Some of them are enumerated here:&lt;br /&gt;
&lt;br /&gt;
* they remove the need for ''passive assertions'' (in the form of comments) and instead actively assert the condition and fail if false during run-time: comments may outlive the code and may not hold for the new code. They act like passive assertions, so its the programmer who has to take care of the condition. In case of ''assert'' statements, they enforce the conditions and never outlive the code. If the code changes, the assert statement has to change too, for the program to execute. They thus act as ''active'' snippets of comments.&lt;br /&gt;
&lt;br /&gt;
* they make you more confident of your code: The programmer makes a certain assumptions during the coding phase. Assertions validate the programmer's assumptions. If any of them turns out to be false, code without assertions may execute and show unexpected behavior. ''Assertions'' avoid such situations and make the code less buggy.&lt;br /&gt;
&lt;br /&gt;
* they help refactor the code: Whenever somebody's refactoring the code, leaving the assertions in place (or modifying them accordingly) ensures that the logic is not flawed and the refactor was actually done (without altering the logic). It is a way to validate the process of refactoring. The same hold true for optimization. Assertions ensure that while in the process, the program logic was not altered.&lt;br /&gt;
&lt;br /&gt;
*  they act as embedded tests: A very good example is the development of Program 1: MeToo. A lot of assertions were used in the unit tests. Assertions are like small tests embedded within the code. They simplify the testing of the code.&lt;br /&gt;
&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26626</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26626"/>
		<updated>2009-11-11T00:49:41Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validates correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They are also a very useful tool to detect logical errors. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. &lt;br /&gt;
&lt;br /&gt;
Numerous other run-time checks can be made. The following example illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an Internal invariant. The latter means that even though its obvious that the result would be 3, we eliminate any logical errors by asserting that.&lt;br /&gt;
&lt;br /&gt;
== Programming languages supporting native assertions ==&lt;br /&gt;
&lt;br /&gt;
The following programming languages support assertions natively:&lt;br /&gt;
&lt;br /&gt;
* Cobra&lt;br /&gt;
* D&lt;br /&gt;
* Eiffel&lt;br /&gt;
* Fortress&lt;br /&gt;
* Lisaac&lt;br /&gt;
* Nice&lt;br /&gt;
* Oxygene (formerly Chrome)&lt;br /&gt;
* Sather&lt;br /&gt;
* SPARK, via static analysis of Ada programs&lt;br /&gt;
* Spec#&lt;br /&gt;
&lt;br /&gt;
== Advantages and disadvantages of assertions ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26625</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26625"/>
		<updated>2009-11-11T00:47:03Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validates correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They are also a very useful tool to detect logical errors. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. &lt;br /&gt;
&lt;br /&gt;
Numerous other run-time checks can be made. The following example illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an Internal invariant. The latter means that even though its obvious that the result would be 3, we eliminate any logical errors by asserting that.&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26624</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26624"/>
		<updated>2009-11-11T00:43:24Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* Types of assertions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validating correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. They are also a very useful tool to detect logical errors. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. Numerous other run-time checks can be made. The following example illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an invariant.&lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....) {&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26623</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26623"/>
		<updated>2009-11-11T00:42:49Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validating correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. They are also a very useful tool to detect logical errors. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. Numerous other run-time checks can be made. The following example illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an invariant.&lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....)&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....)&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26622</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26622"/>
		<updated>2009-11-11T00:42:23Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validating correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. They are also a very useful tool to detect logical errors. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. Numerous other run-time checks can be made. The following example illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an invariant.&lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Invariants (Control-flow, Loop etc.)''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
As Dr.Gehringer mentions, the first three classes are discussed in class and will not be a focus of this wiki. Instead, this will concentrate on the other types of assertions, viz., Control flow, Loop invariants and Loop variants. Invariants are those conditions with a precondition as well as post condition. A loop invariant is an expression for a variable which remains constant through-out the loop. On the other hand, control-flow invariants are those cases which specify that the control should never reach to that part of code. Consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....)&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
  /* Control should never reach here */&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now observe how control-flow invariance can be validated by assertions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
for (....)&lt;br /&gt;
   if (...)&lt;br /&gt;
       return x;&lt;br /&gt;
   else if (...)&lt;br /&gt;
       return y;&lt;br /&gt;
  &lt;br /&gt;
   assert false&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26611</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26611"/>
		<updated>2009-11-11T00:26:27Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validating correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. They are also a very useful tool to detect logical errors. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. Numerous other run-time checks can be made. The following example illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1) {....}&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2) {....}&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an invariant.&lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants''&lt;br /&gt;
*''Loop invariants''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26610</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26610"/>
		<updated>2009-11-11T00:25:05Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validating correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. They are also a very useful tool to detect logical errors. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the variables reaches the ''default'' segment, then there is a logical error in the program. Numerous other run-time checks can be made. The following example illustrates that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
if (threads % 4 == 0)&lt;br /&gt;
    ....&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 1)&lt;br /&gt;
    ....&lt;br /&gt;
&lt;br /&gt;
else if (threads % 4 == 2)&lt;br /&gt;
    ....&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
   // we know that it has to be 3&lt;br /&gt;
   assert(threads % 4 == 3);&lt;br /&gt;
   ....&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is called as asserting an invariant.&lt;br /&gt;
&lt;br /&gt;
== Types of assertions ==&lt;br /&gt;
&lt;br /&gt;
Assertions can be categorized primarily as follows:&lt;br /&gt;
&lt;br /&gt;
*''Pre-conditions''&lt;br /&gt;
*''Post-conditions''&lt;br /&gt;
*''Class invariants'&lt;br /&gt;
*''Loop invariants''&lt;br /&gt;
*''Loop variants''&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26605</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26605"/>
		<updated>2009-11-11T00:12:54Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validating correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. They are also a very useful tool to detect errors in control flow. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the control flow reaches the ''default'' then there is a logical error in the program.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26604</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26604"/>
		<updated>2009-11-11T00:12:30Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validating correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. They are also a very useful tool to detect errors in control flow. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2: ....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the control flow reaches the ''default'' then there is a logical error in the program.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26602</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26602"/>
		<updated>2009-11-10T23:57:13Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validating correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. They are also a very useful tool to detect errors in control flow. For e.g consider the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
switch(scase) {&lt;br /&gt;
   case 1: ....&lt;br /&gt;
&lt;br /&gt;
   case 2:....&lt;br /&gt;
&lt;br /&gt;
   default: assert false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code fragment clearly says that the programmer assumes that the variable ''scase'' will take either of the listed values. If the control flow reaches the ''default'' then there is a logical error in the program.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26601</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26601"/>
		<updated>2009-11-10T23:53:25Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* ''Planning''&lt;br /&gt;
* ''Design''&lt;br /&gt;
* ''Development''&lt;br /&gt;
* ''Testing''&lt;br /&gt;
* ''Release and Maintenance''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validating correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26600</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26600"/>
		<updated>2009-11-10T23:52:59Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Programming with assertions ==&lt;br /&gt;
Assertions are predicates or statements with expressions which the programmer thinks should be true at the time of execution. Assertions are a powerful way of detecting bugs in programs.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* '''Planning'''&lt;br /&gt;
* '''Design'''&lt;br /&gt;
* '''Development'''&lt;br /&gt;
* '''Testing'''&lt;br /&gt;
* '''Release and Maintenance'''&lt;br /&gt;
&lt;br /&gt;
It is impossible for a programmer to make any program a hundred percent bug free. Even worse, there maybe subtle things which the programmer assumes are always true but may not be so in many corner cases. Debugging is an integral part of the Software Process. Bugs can crop up anytime due to various test cases formulated all through these aforementioned stages. To be sure that whatever the programmer assumes is true, assertions can be set up in the program. If ever, the condition evaluates to be false, the program terminates with an assertion. Another way to put it is that assertions are a way to show the programmer that things cannot be taken for granted by the latter. Assertions can be thought of as medium of validating the correctness of modules.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
The various uses of assertions are:&lt;br /&gt;
* '''Validating correctness of (sub)program'''&lt;br /&gt;
* '''Supports programming by contract (documentation)'''&lt;br /&gt;
* '''Helps in debugging'''&lt;br /&gt;
* '''Exception handling by integrating assertion failures to be detected dynamically'''&lt;br /&gt;
&lt;br /&gt;
Assertions can be used by the programmer to make sure that wrong runtime assumptions (by the programmer) can be caught. &lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26599</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 15 assertions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_15_assertions&amp;diff=26599"/>
		<updated>2009-11-10T23:26:29Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Integration and Function Testing and beyond ==&lt;br /&gt;
Software testing is the science of breaking software down. During testing we have one and only one aim to develop comprehensive test cases to find bugs in the software and get them fixed.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* '''Planning'''&lt;br /&gt;
* '''Design'''&lt;br /&gt;
* '''Development'''&lt;br /&gt;
* '''Testing'''&lt;br /&gt;
* '''Release and Maintenance'''&lt;br /&gt;
&lt;br /&gt;
Each stage can be further broken down into a number of several stages. This article focuses on the Testing phase. Software testing can be defined as inspection or investigation of a product to ascertain its quality and verify if its semantics are implemented the way they are intended to. Testing can however, be done outside the Software Development cycle too. &lt;br /&gt;
&lt;br /&gt;
Testing can be broadly classified into the following methodologies &amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
* '''Unit testing'''&lt;br /&gt;
* '''Integration testing'''&lt;br /&gt;
* '''Functional or Validation testing'''&lt;br /&gt;
* '''System testing'''&lt;br /&gt;
&lt;br /&gt;
The various testing processes/methods listed can be put in chronological order and can be viewed as a chain process. Each phase is an important part of the overall testing process. Unit test concentrates on the basic building blocks of the product, verifying if each component works correctly. The next phase is the Integration Testing. When many such units are knit together to form a larger, more complex block, it becomes necessary to test if all the smaller units of the bigger block interact properly to implement the semantics of the bigger block, as desired. The process that follows this stage is the Functional or Validation testing. This phase focuses on the behavior and performance in most cases. The question asked here is “If all the complex blocks are properly integrated, are they producing the result which they are required to?” The last phase is the System Testing. This mostly deals with interaction on the hardware-software platform and/or integration of the product on a platform, as viewed from a higher level. Here we will focus our discussion on Integration and Functional Testing.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
Testing is a very important phase in the software development cycle. The cycle can either follow the ''Waterfall'' [http://en.wikipedia.org/wiki/Waterfall_model] model or the ''Spiral'' model [http://en.wikipedia.org/wiki/Spiral_model]. The latter mandates testing continuously as opposed to the former’s discrete phase. No software product is completely free of defects. No matter how much care the design team takes, its impossible to ensure that there are absolutely no bugs. This is where testing comes in. The goal of the testing process is to try and break the software.&lt;br /&gt;
&lt;br /&gt;
Considering a large project, individual modules or units maybe developed by different team or even outsourced to different companies. Each team would have tested their respective modules or units. When, however, these modules are integrated climbing a level up, further testing maybe required to ensure that these units interact with other in a way which does not break the product. An important point in the development plan is the decision on the interface of each module. A common interface eliminates most of the bugs, but a final integration test ensures that everything is clean. &lt;br /&gt;
&lt;br /&gt;
Making sure that the units or modules integrate with each other is not enough. The result produced by integrating the modules and the behavior exhibited after integration is another important aspect of the development plan. A software is designed with a certain behavior and functionality in mind. Functional testing deals with testing the product for functional issues. Its goal is to ensure that the product is doing what it was intended to do in the design phase.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=25780</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=25780"/>
		<updated>2009-10-13T18:08:45Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is ''processed'' while instructions are ''executed''. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a different paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a ''&amp;quot;watchdog&amp;quot;'' to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program&amp;lt;sup&amp;gt;[2]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== List of reflective programming languages and platforms ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown &amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
; atomic : An atomic operation in computer science refers to a set of operations that can be combined so that they appear to the rest of the system to be a single operation with only two possible outcomes: success or failure.&lt;br /&gt;
; metadata : Metadata is &amp;quot;data about data&amp;quot;, of any sort in any media. It aids in clarifying and finding the actual data.&lt;br /&gt;
; malware : Malware, short for malicious software, is software designed to infiltrate a computer without the owner's informed consent.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# [http://cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
# [http://biophp.net/index.php/Reflective Reflective]&lt;br /&gt;
# [http://en.allexperts.com/e/s/se/self-modifying_code.htm Self-modifying code]&lt;br /&gt;
# [http://en.allexperts.com/e/l/li/list_of_reflective_programming_languages_and_platforms.htm List of reflective programming languages and platforms]&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=25594</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=25594"/>
		<updated>2009-10-10T04:35:23Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is ''processed'' while instructions are ''executed''. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a different paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a ''&amp;quot;watchdog&amp;quot;'' to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program&amp;lt;sup&amp;gt;[2]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== List of reflective programming languages and platforms ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
; atomic : An atomic operation in computer science refers to a set of operations that can be combined so that they appear to the rest of the system to be a single operation with only two possible outcomes: success or failure.&lt;br /&gt;
; metadata : Metadata is &amp;quot;data about data&amp;quot;, of any sort in any media. It aids in clarifying and finding the actual data.&lt;br /&gt;
; malware : Malware, short for malicious software, is software designed to infiltrate a computer without the owner's informed consent.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# [http://cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
# [http://biophp.net/index.php/Reflective Reflective]&lt;br /&gt;
# [http://en.allexperts.com/e/s/se/self-modifying_code.htm Self-modifying code]&lt;br /&gt;
# [http://en.allexperts.com/e/l/li/list_of_reflective_programming_languages_and_platforms.htm List of reflective programming languages and platforms]&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23111</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23111"/>
		<updated>2009-10-08T20:52:37Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is ''processed'' while instructions are ''executed''. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a different paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a ''&amp;quot;watchdog&amp;quot;'' to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program&amp;lt;sup&amp;gt;[2]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== List of reflective programming languages and platforms ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
; atomic : An atomic operation in computer science refers to a set of operations that can be combined so that they appear to the rest of the system to be a single operation with only two possible outcomes: success or failure.&lt;br /&gt;
; metadata : Metadata is &amp;quot;data about data&amp;quot;, of any sort in any media. It aids in clarifying and finding the actual data.&lt;br /&gt;
; malware : Malware, short for malicious software, is software designed to infiltrate a computer without the owner's informed consent.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# [http://cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
# [http://biophp.net/index.php/Reflective Reflective]&lt;br /&gt;
# [http://en.allexperts.com/e/s/se/self-modifying_code.htm Self-modifying code]&lt;br /&gt;
# [http://en.allexperts.com/e/l/li/list_of_reflective_programming_languages_and_platforms.htm List of reflective programming languages and platforms]&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23107</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23107"/>
		<updated>2009-10-08T20:49:28Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.[1]&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflective programming languages and platforms ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
; atomic : An atomic operation in computer science refers to a set of operations that can be combined so that they appear to the rest of the system to be a single operation with only two possible outcomes: success or failure.&lt;br /&gt;
; metadata : Metadata is &amp;quot;data about data&amp;quot;, of any sort in any media. It aids in clarifying and finding the actual data.&lt;br /&gt;
; malware : Malware, short for malicious software, is software designed to infiltrate a computer without the owner's informed consent.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# [http://cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
# [http://biophp.net/index.php/Reflective Reflective]&lt;br /&gt;
# [http://en.allexperts.com/e/s/se/self-modifying_code.htm Self-modifying code]&lt;br /&gt;
# [http://en.allexperts.com/e/l/li/list_of_reflective_programming_languages_and_platforms.htm List of reflective programming languages and platforms]&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23105</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23105"/>
		<updated>2009-10-08T20:47:35Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
* ''atomic'': An atomic operation in computer science refers to a set of operations that can be combined so that they appear to the rest of the system to be a single operation with only two possible outcomes: success or failure.&lt;br /&gt;
* ''metadata'': Metadata is &amp;quot;data about data&amp;quot;, of any sort in any media. It aids in clarifying and finding the actual data.&lt;br /&gt;
* ''malware'': Malware, short for malicious software, is software designed to infiltrate a computer without the owner's informed consent.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# [http://cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
# [http://biophp.net/index.php/Reflective Reflective]&lt;br /&gt;
# [http://en.allexperts.com/e/s/se/self-modifying_code.htm Self-modifying code]&lt;br /&gt;
# [http://en.allexperts.com/e/l/li/list_of_reflective_programming_languages_and_platforms.htm List of reflective programming languages and platforms]&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23104</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23104"/>
		<updated>2009-10-08T20:46:40Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
* ''atomic'': An atomic operation in computer science refers to a set of operations that can be combined so that they appear to the rest of the system to be a single operation with only two possible outcomes: success or failure.&lt;br /&gt;
* ''metadata'': Metadata is &amp;quot;data about data&amp;quot;, of any sort in any media. It aids in clarifying and finding the actual data.&lt;br /&gt;
* ''malware'': Malware, short for malicious software, is software designed to infiltrate a computer without the owner's informed consent.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# [http://cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
# http://biophp.net/index.php/Reflective&lt;br /&gt;
# http://en.allexperts.com/e/s/se/self-modifying_code.htm&lt;br /&gt;
# http://en.allexperts.com/e/l/li/list_of_reflective_programming_languages_and_platforms.htm&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23103</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23103"/>
		<updated>2009-10-08T20:46:21Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
* ''atomic'': An atomic operation in computer science refers to a set of operations that can be combined so that they appear to the rest of the system to be a single operation with only two possible outcomes: success or failure.&lt;br /&gt;
* ''metadata'': Metadata is &amp;quot;data about data&amp;quot;, of any sort in any media. It aids in clarifying and finding the actual data.&lt;br /&gt;
* ''malware'': Malware, short for malicious software, is software designed to infiltrate a computer without the owner's informed consent.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# [An Introduction to Reflection-Oriented Programming http://cs.indiana.edu/~jsobel/rop.html]&lt;br /&gt;
# http://biophp.net/index.php/Reflective&lt;br /&gt;
# http://en.allexperts.com/e/s/se/self-modifying_code.htm&lt;br /&gt;
# http://en.allexperts.com/e/l/li/list_of_reflective_programming_languages_and_platforms.htm&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23102</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23102"/>
		<updated>2009-10-08T20:45:42Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
* ''atomic'': An atomic operation in computer science refers to a set of operations that can be combined so that they appear to the rest of the system to be a single operation with only two possible outcomes: success or failure.&lt;br /&gt;
* ''metadata'': Metadata is &amp;quot;data about data&amp;quot;, of any sort in any media. It aids in clarifying and finding the actual data.&lt;br /&gt;
* ''malware'': Malware, short for malicious software, is software designed to infiltrate a computer without the owner's informed consent.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;br /&gt;
# http://biophp.net/index.php/Reflective&lt;br /&gt;
# http://en.allexperts.com/e/s/se/self-modifying_code.htm&lt;br /&gt;
# http://en.allexperts.com/e/l/li/list_of_reflective_programming_languages_and_platforms.htm&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23096</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23096"/>
		<updated>2009-10-08T20:40:45Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23093</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23093"/>
		<updated>2009-10-08T20:39:48Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
// Hello World in Microsoft C# (&amp;quot;C-Sharp&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
&lt;br /&gt;
class HelloWorld&lt;br /&gt;
{&lt;br /&gt;
    public static int Main(String[] args)&lt;br /&gt;
    {&lt;br /&gt;
        Console.WriteLine(&amp;quot;Hello, World!&amp;quot;);&lt;br /&gt;
        return 0;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23092</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23092"/>
		<updated>2009-10-08T20:39:12Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease }&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23091</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23091"/>
		<updated>2009-10-08T20:39:03Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23089</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23089"/>
		<updated>2009-10-08T20:38:37Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease } &lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23088</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23088"/>
		<updated>2009-10-08T20:38:12Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
repeat N times {&lt;br /&gt;
   increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease } &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23087</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23087"/>
		<updated>2009-10-08T20:37:24Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
repeat N times {&lt;br /&gt;
increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease } &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23085</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23085"/>
		<updated>2009-10-08T20:34:53Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
Non-reflective approach:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The optimized version of the pseudo-code with a reflective approach is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
repeat N times {&lt;br /&gt;
increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch { replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease } &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23083</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23083"/>
		<updated>2009-10-08T20:33:29Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too. One interesting observation is the use of self-modifying code to hide copy-protection in DOS applications. It can also be used to hide the presence of a program. This technique may prove harmful if a malware made use of this paradigm. For such reason, some Operating Systems such as OpenBSD have explicit control over self-modifying code.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
An example of a self-modifying pseudo-code for Optimization of a state dependent loop is shown:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;repeat N times {&lt;br /&gt;
   if STATE is 1&lt;br /&gt;
    increase A by one&lt;br /&gt;
   else&lt;br /&gt;
    decrease A by one&lt;br /&gt;
&lt;br /&gt;
   do something with A&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Self-modifying code in this case would simply be a matter of rewriting the loop like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;repeat N times {&lt;br /&gt;
increase A by one&lt;br /&gt;
   do something with A&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  when STATE has to switch {&lt;br /&gt;
replace the opcode &amp;quot;increase&amp;quot; above with the opcode to decrease } &amp;lt;/code&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23079</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23079"/>
		<updated>2009-10-08T20:27:55Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
* Universal system for different situations (adaptation and code simplicity)&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too.&lt;br /&gt;
&lt;br /&gt;
== List of reflection-oriented programming languages ==&lt;br /&gt;
Some of the languages that have inherent reflection oriented programming support are:&lt;br /&gt;
&lt;br /&gt;
* APL&lt;br /&gt;
* ColdFusion MX&lt;br /&gt;
* Curl&lt;br /&gt;
* Delphi&lt;br /&gt;
* ECMAScript (ActionScript, DMDScript, JavaScript, JScript)&lt;br /&gt;
* Java&lt;br /&gt;
* Lisp&lt;br /&gt;
* Logo&lt;br /&gt;
* C#&lt;br /&gt;
* Visual Basic .NET&lt;br /&gt;
* Objective-C&lt;br /&gt;
* Perl&lt;br /&gt;
* PHP&lt;br /&gt;
* Pico&lt;br /&gt;
* Pliant&lt;br /&gt;
* POP-11&lt;br /&gt;
* Prolog&lt;br /&gt;
* Python&lt;br /&gt;
* Ruby&lt;br /&gt;
* Scheme&lt;br /&gt;
* Smalltalk&lt;br /&gt;
* Tcl&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23077</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23077"/>
		<updated>2009-10-08T20:23:19Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose and Uses ==&lt;br /&gt;
The basic purpose of reflection oriented programming is to introduce flexibility. Broadly the uses of reflection-oriented programming can be classified as:&lt;br /&gt;
* Optimization of a state dependent loop&lt;br /&gt;
* Application of a specialized algorithm to a data set depending on the runtime data information&lt;br /&gt;
* Obfuscating the code to prevent reverse-engineering&lt;br /&gt;
* Protection of code from malware&lt;br /&gt;
* Decompression of code at runtime&lt;br /&gt;
&lt;br /&gt;
Apart from these, there are huge number of uses and many unexplored uses too.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23074</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23074"/>
		<updated>2009-10-08T20:16:29Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, tasks can be classified into:&lt;br /&gt;
* ''atomic'' : this category of operations/tasks cannot be interrupted and usually consist of a single step&lt;br /&gt;
* ''complex'' : this category of operations/tasks involve multiple steps (or atomic operations) and can be interrupted in the middle of computation&lt;br /&gt;
&lt;br /&gt;
The reason why these categories are brought up here is that, atomic operations being single step do not have a specific structure associated with them. However, the complex tasks/blocks lose their structure when a program is compiled in a non-reflective language. It is necessary to preserve its architecture for reflective programs. The block can be thought of as a state-machine which has pre-defined states data will be in or transition to in case of specific events. This whole package is the metadata that is saved for preserving the structure or architecture of the program.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23068</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23068"/>
		<updated>2009-10-08T20:03:14Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Reflective Paradigm ==&lt;br /&gt;
Reflected-oriented programming is the concept used to write Reflective programs. This allows the program architecture to be decided during the course of execution and is not &amp;quot;hard-wired&amp;quot; to the procedural structure. This paradigm supplements the already-existing object-oriented programming to enhance it with the ''self-modifying-code'' feature. The control flow is something which is decided at runtime; this is important since dynamically altered program can change course of execution of a particular event due to modification. Hence, this paradigm requires that the program contain sequence of decisions be implemented rather than the strictness of decision, based on the run-time data. &lt;br /&gt;
&lt;br /&gt;
On a broad perspective, ing&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23063</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 8 rop</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_8_rop&amp;diff=23063"/>
		<updated>2009-10-08T19:52:24Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Reflection-oriented programming ==&lt;br /&gt;
Traditional programming has always separated data from the instructions. Even though the memory system that stores them doesn't make any distinction between them, the way they are handled is the only differentiator. Data is &amp;quot;processed&amp;quot; while instructions are &amp;quot;executed&amp;quot;. Reflection-oriented programming is a technique in which the program is made intelligent enough to modify their behavior.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Refection-oriented programming is a new paradigm which deals with understanding the computation as a task rather than a program. Conceptually, it can be thought as the program setting up a &amp;quot;watchdog&amp;quot; to observe the changes and self-modify accordingly based on the observations. One thing to be mentioned here is that this paradigm goes well with dynamically typed languages such as Ruby, Lisp etc. The core behind this paradigm is the flexibility of treating the instructions as data so that all the policies of data modification can be applied onto them.&lt;br /&gt;
&lt;br /&gt;
== Paradigm implementation ==&lt;br /&gt;
In most of the languages as the code is compiled/assembled the structure of the program is lost. However, the key to implementing this programming paradigm is to preserve the structure so that the program can be analyzed and modified accordingly. To enable this, the program structure is preserved as metadata in the code. This ensures that even though the compiled/assembled code doesn't maintain the organization, in favor of optimization mostly, the code can be made self-modified. There are some languages like Lisp which do not separate compile-time and run-time. In such cases, there is no difference in the code.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# http://cs.indiana.edu/~jsobel/rop.html&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22091</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 iftesting</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22091"/>
		<updated>2009-09-27T23:03:10Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Integration and Function Testing and beyond ==&lt;br /&gt;
Software testing is the science of breaking software down. During testing we have one and only one aim to develop comprehensive test cases to find bugs in the software and get them fixed.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* '''Planning'''&lt;br /&gt;
* '''Design'''&lt;br /&gt;
* '''Development'''&lt;br /&gt;
* '''Testing'''&lt;br /&gt;
* '''Release and Maintenance'''&lt;br /&gt;
&lt;br /&gt;
Each stage can be further broken down into a number of several stages. This article focuses on the Testing phase. Software testing can be defined as inspection or investigation of a product to ascertain its quality and verify if its semantics are implemented the way they are intended to. Testing can however, be done outside the Software Development cycle too. &lt;br /&gt;
&lt;br /&gt;
Testing can be broadly classified into the following methodologies &amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
* '''Unit testing'''&lt;br /&gt;
* '''Integration testing'''&lt;br /&gt;
* '''Functional or Validation testing'''&lt;br /&gt;
* '''System testing'''&lt;br /&gt;
&lt;br /&gt;
The various testing processes/methods listed can be put in chronological order and can be viewed as a chain process. Each phase is an important part of the overall testing process. Unit test concentrates on the basic building blocks of the product, verifying if each component works correctly. The next phase is the Integration Testing. When many such units are knit together to form a larger, more complex block, it becomes necessary to test if all the smaller units of the bigger block interact properly to implement the semantics of the bigger block, as desired. The process that follows this stage is the Functional or Validation testing. This phase focuses on the behavior and performance in most cases. The question asked here is “If all the complex blocks are properly integrated, are they producing the result which they are required to?” The last phase is the System Testing. This mostly deals with interaction on the hardware-software platform and/or integration of the product on a platform, as viewed from a higher level. Here we will focus our discussion on Integration and Functional Testing.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
Testing is a very important phase in the software development cycle. The cycle can either follow the ''Waterfall'' [http://en.wikipedia.org/wiki/Waterfall_model] model or the ''Spiral'' model [http://en.wikipedia.org/wiki/Spiral_model]. The latter mandates testing continuously as opposed to the former’s discrete phase. No software product is completely free of defects. No matter how much care the design team takes, its impossible to ensure that there are absolutely no bugs. This is where testing comes in. The goal of the testing process is to try and break the software.&lt;br /&gt;
&lt;br /&gt;
Considering a large project, individual modules or units maybe developed by different team or even outsourced to different companies. Each team would have tested their respective modules or units. When, however, these modules are integrated climbing a level up, further testing maybe required to ensure that these units interact with other in a way which does not break the product. An important point in the development plan is the decision on the interface of each module. A common interface eliminates most of the bugs, but a final integration test ensures that everything is clean. &lt;br /&gt;
&lt;br /&gt;
Making sure that the units or modules integrate with each other is not enough. The result produced by integrating the modules and the behavior exhibited after integration is another important aspect of the development plan. A software is designed with a certain behavior and functionality in mind. Functional testing deals with testing the product for functional issues. Its goal is to ensure that the product is doing what it was intended to do in the design phase.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot; New York McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22090</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 iftesting</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22090"/>
		<updated>2009-09-27T23:02:59Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Integration and Function Testing and beyond ==&lt;br /&gt;
Software testing is the science of breaking software down. During testing we have one and only one aim to develop comprehensive test cases to find bugs in the software and get them fixed.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* '''Planning'''&lt;br /&gt;
* '''Design'''&lt;br /&gt;
* '''Development'''&lt;br /&gt;
* '''Testing'''&lt;br /&gt;
* '''Release and Maintenance'''&lt;br /&gt;
&lt;br /&gt;
Each stage can be further broken down into a number of several stages. This article focuses on the Testing phase. Software testing can be defined as inspection or investigation of a product to ascertain its quality and verify if its semantics are implemented the way they are intended to. Testing can however, be done outside the Software Development cycle too. &lt;br /&gt;
&lt;br /&gt;
Testing can be broadly classified into the following methodologies &amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
* '''Unit testing'''&lt;br /&gt;
* '''Integration testing'''&lt;br /&gt;
* '''Functional or Validation testing'''&lt;br /&gt;
* '''System testing'''&lt;br /&gt;
&lt;br /&gt;
The various testing processes/methods listed can be put in chronological order and can be viewed as a chain process. Each phase is an important part of the overall testing process. Unit test concentrates on the basic building blocks of the product, verifying if each component works correctly. The next phase is the Integration Testing. When many such units are knit together to form a larger, more complex block, it becomes necessary to test if all the smaller units of the bigger block interact properly to implement the semantics of the bigger block, as desired. The process that follows this stage is the Functional or Validation testing. This phase focuses on the behavior and performance in most cases. The question asked here is “If all the complex blocks are properly integrated, are they producing the result which they are required to?” The last phase is the System Testing. This mostly deals with interaction on the hardware-software platform and/or integration of the product on a platform, as viewed from a higher level. Here we will focus our discussion on Integration and Functional Testing.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
Testing is a very important phase in the software development cycle. The cycle can either follow the ''Waterfall'' [http://en.wikipedia.org/wiki/Waterfall_model] model or the ''Spiral'' model [http://en.wikipedia.org/wiki/Spiral_model]. The latter mandates testing continuously as opposed to the former’s discrete phase. No software product is completely free of defects. No matter how much care the design team takes, its impossible to ensure that there are absolutely no bugs. This is where testing comes in. The goal of the testing process is to try and break the software.&lt;br /&gt;
&lt;br /&gt;
Considering a large project, individual modules or units maybe developed by different team or even outsourced to different companies. Each team would have tested their respective modules or units. When, however, these modules are integrated climbing a level up, further testing maybe required to ensure that these units interact with other in a way which does not break the product. An important point in the development plan is the decision on the interface of each module. A common interface eliminates most of the bugs, but a final integration test ensures that everything is clean. &lt;br /&gt;
&lt;br /&gt;
Making sure that the units or modules integrate with each other is not enough. The result produced by integrating the modules and the behavior exhibited after integration is another important aspect of the development plan. A software is designed with a certain behavior and functionality in mind. Functional testing deals with testing the product for functional issues. Its goal is to ensure that the product is doing what it was intended to do in the design phase.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering &amp;quot;A Practitioner Approach&amp;quot;. New York: McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22089</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 iftesting</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22089"/>
		<updated>2009-09-27T23:02:07Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Integration and Function Testing and beyond ==&lt;br /&gt;
Software testing is the science of breaking software down. During testing we have one and only one aim to develop comprehensive test cases to find bugs in the software and get them fixed.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* '''Planning'''&lt;br /&gt;
* '''Design'''&lt;br /&gt;
* '''Development'''&lt;br /&gt;
* '''Testing'''&lt;br /&gt;
* '''Release and Maintenance'''&lt;br /&gt;
&lt;br /&gt;
Each stage can be further broken down into a number of several stages. This article focuses on the Testing phase. Software testing can be defined as inspection or investigation of a product to ascertain its quality and verify if its semantics are implemented the way they are intended to. Testing can however, be done outside the Software Development cycle too. &lt;br /&gt;
&lt;br /&gt;
Testing can be broadly classified into the following methodologies &amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
* '''Unit testing'''&lt;br /&gt;
* '''Integration testing'''&lt;br /&gt;
* '''Functional or Validation testing'''&lt;br /&gt;
* '''System testing'''&lt;br /&gt;
&lt;br /&gt;
The various testing processes/methods listed can be put in chronological order and can be viewed as a chain process. Each phase is an important part of the overall testing process. Unit test concentrates on the basic building blocks of the product, verifying if each component works correctly. The next phase is the Integration Testing. When many such units are knit together to form a larger, more complex block, it becomes necessary to test if all the smaller units of the bigger block interact properly to implement the semantics of the bigger block, as desired. The process that follows this stage is the Functional or Validation testing. This phase focuses on the behavior and performance in most cases. The question asked here is “If all the complex blocks are properly integrated, are they producing the result which they are required to?” The last phase is the System Testing. This mostly deals with interaction on the hardware-software platform and/or integration of the product on a platform, as viewed from a higher level. Here we will focus our discussion on Integration and Functional Testing.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
Testing is a very important phase in the software development cycle. The cycle can either follow the ''Waterfall'' [http://en.wikipedia.org/wiki/Waterfall_model] model or the ''Spiral'' model [http://en.wikipedia.org/wiki/Spiral_model]. The latter mandates testing continuously as opposed to the former’s discrete phase. No software product is completely free of defects. No matter how much care the design team takes, its impossible to ensure that there are absolutely no bugs. This is where testing comes in. The goal of the testing process is to try and break the software.&lt;br /&gt;
&lt;br /&gt;
Considering a large project, individual modules or units maybe developed by different team or even outsourced to different companies. Each team would have tested their respective modules or units. When, however, these modules are integrated climbing a level up, further testing maybe required to ensure that these units interact with other in a way which does not break the product. An important point in the development plan is the decision on the interface of each module. A common interface eliminates most of the bugs, but a final integration test ensures that everything is clean. &lt;br /&gt;
&lt;br /&gt;
Making sure that the units or modules integrate with each other is not enough. The result produced by integrating the modules and the behavior exhibited after integration is another important aspect of the development plan. A software is designed with a certain behavior and functionality in mind. Functional testing deals with testing the product for functional issues. Its goal is to ensure that the product is doing what it was intended to do in the design phase.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering. A Practitioner Approach: New York: McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22088</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 iftesting</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22088"/>
		<updated>2009-09-27T23:01:45Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Integration and Function Testing and beyond ==&lt;br /&gt;
Software testing is the science of breaking software down. During testing we have one and only one aim to develop comprehensive test cases to find bugs in the software and get them fixed.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy: Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* '''Planning'''&lt;br /&gt;
* '''Design'''&lt;br /&gt;
* '''Development'''&lt;br /&gt;
* '''Testing'''&lt;br /&gt;
* '''Release and Maintenance'''&lt;br /&gt;
&lt;br /&gt;
Each stage can be further broken down into a number of several stages. This article focuses on the Testing phase. Software testing can be defined as inspection or investigation of a product to ascertain its quality and verify if its semantics are implemented the way they are intended to. Testing can however, be done outside the Software Development cycle too. &lt;br /&gt;
&lt;br /&gt;
Testing can be broadly classified into the following methodologies &amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
* '''Unit testing'''&lt;br /&gt;
* '''Integration testing'''&lt;br /&gt;
* '''Functional or Validation testing'''&lt;br /&gt;
* '''System testing'''&lt;br /&gt;
&lt;br /&gt;
The various testing processes/methods listed can be put in chronological order and can be viewed as a chain process. Each phase is an important part of the overall testing process. Unit test concentrates on the basic building blocks of the product, verifying if each component works correctly. The next phase is the Integration Testing. When many such units are knit together to form a larger, more complex block, it becomes necessary to test if all the smaller units of the bigger block interact properly to implement the semantics of the bigger block, as desired. The process that follows this stage is the Functional or Validation testing. This phase focuses on the behavior and performance in most cases. The question asked here is “If all the complex blocks are properly integrated, are they producing the result which they are required to?” The last phase is the System Testing. This mostly deals with interaction on the hardware-software platform and/or integration of the product on a platform, as viewed from a higher level. Here we will focus our discussion on Integration and Functional Testing.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
Testing is a very important phase in the software development cycle. The cycle can either follow the ''Waterfall'' [http://en.wikipedia.org/wiki/Waterfall_model] model or the ''Spiral'' model [http://en.wikipedia.org/wiki/Spiral_model]. The latter mandates testing continuously as opposed to the former’s discrete phase. No software product is completely free of defects. No matter how much care the design team takes, its impossible to ensure that there are absolutely no bugs. This is where testing comes in. The goal of the testing process is to try and break the software.&lt;br /&gt;
&lt;br /&gt;
Considering a large project, individual modules or units maybe developed by different team or even outsourced to different companies. Each team would have tested their respective modules or units. When, however, these modules are integrated climbing a level up, further testing maybe required to ensure that these units interact with other in a way which does not break the product. An important point in the development plan is the decision on the interface of each module. A common interface eliminates most of the bugs, but a final integration test ensures that everything is clean. &lt;br /&gt;
&lt;br /&gt;
Making sure that the units or modules integrate with each other is not enough. The result produced by integrating the modules and the behavior exhibited after integration is another important aspect of the development plan. A software is designed with a certain behavior and functionality in mind. Functional testing deals with testing the product for functional issues. Its goal is to ensure that the product is doing what it was intended to do in the design phase.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering. A Practitioner Approach: New York: McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22087</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 iftesting</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22087"/>
		<updated>2009-09-27T23:01:18Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* Functional Testing and beyond */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Integration and Function Testing and beyond ==&lt;br /&gt;
Software testing is the science of breaking software down. During testing we have one and only one aim to develop comprehensive test cases to find bugs in the software and get them fixed.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* '''Planning'''&lt;br /&gt;
* '''Design'''&lt;br /&gt;
* '''Development'''&lt;br /&gt;
* '''Testing'''&lt;br /&gt;
* '''Release and Maintenance'''&lt;br /&gt;
&lt;br /&gt;
Each stage can be further broken down into a number of several stages. This article focuses on the Testing phase. Software testing can be defined as inspection or investigation of a product to ascertain its quality and verify if its semantics are implemented the way they are intended to. Testing can however, be done outside the Software Development cycle too. &lt;br /&gt;
&lt;br /&gt;
Testing can be broadly classified into the following methodologies &amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
* '''Unit testing'''&lt;br /&gt;
* '''Integration testing'''&lt;br /&gt;
* '''Functional or Validation testing'''&lt;br /&gt;
* '''System testing'''&lt;br /&gt;
&lt;br /&gt;
The various testing processes/methods listed can be put in chronological order and can be viewed as a chain process. Each phase is an important part of the overall testing process. Unit test concentrates on the basic building blocks of the product, verifying if each component works correctly. The next phase is the Integration Testing. When many such units are knit together to form a larger, more complex block, it becomes necessary to test if all the smaller units of the bigger block interact properly to implement the semantics of the bigger block, as desired. The process that follows this stage is the Functional or Validation testing. This phase focuses on the behavior and performance in most cases. The question asked here is “If all the complex blocks are properly integrated, are they producing the result which they are required to?” The last phase is the System Testing. This mostly deals with interaction on the hardware-software platform and/or integration of the product on a platform, as viewed from a higher level. Here we will focus our discussion on Integration and Functional Testing.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
Testing is a very important phase in the software development cycle. The cycle can either follow the ''Waterfall'' [http://en.wikipedia.org/wiki/Waterfall_model] model or the ''Spiral'' model [http://en.wikipedia.org/wiki/Spiral_model]. The latter mandates testing continuously as opposed to the former’s discrete phase. No software product is completely free of defects. No matter how much care the design team takes, its impossible to ensure that there are absolutely no bugs. This is where testing comes in. The goal of the testing process is to try and break the software.&lt;br /&gt;
&lt;br /&gt;
Considering a large project, individual modules or units maybe developed by different team or even outsourced to different companies. Each team would have tested their respective modules or units. When, however, these modules are integrated climbing a level up, further testing maybe required to ensure that these units interact with other in a way which does not break the product. An important point in the development plan is the decision on the interface of each module. A common interface eliminates most of the bugs, but a final integration test ensures that everything is clean. &lt;br /&gt;
&lt;br /&gt;
Making sure that the units or modules integrate with each other is not enough. The result produced by integrating the modules and the behavior exhibited after integration is another important aspect of the development plan. A software is designed with a certain behavior and functionality in mind. Functional testing deals with testing the product for functional issues. Its goal is to ensure that the product is doing what it was intended to do in the design phase.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy: Latvian Technological Center[http://www.innovation.lv]]] A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering. A Practitioner Approach: New York: McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22086</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 iftesting</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22086"/>
		<updated>2009-09-27T23:00:40Z</updated>

		<summary type="html">&lt;p&gt;Ird: /* Functional Testing and beyond */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Integration and Function Testing and beyond ==&lt;br /&gt;
Software testing is the science of breaking software down. During testing we have one and only one aim to develop comprehensive test cases to find bugs in the software and get them fixed.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* '''Planning'''&lt;br /&gt;
* '''Design'''&lt;br /&gt;
* '''Development'''&lt;br /&gt;
* '''Testing'''&lt;br /&gt;
* '''Release and Maintenance'''&lt;br /&gt;
&lt;br /&gt;
Each stage can be further broken down into a number of several stages. This article focuses on the Testing phase. Software testing can be defined as inspection or investigation of a product to ascertain its quality and verify if its semantics are implemented the way they are intended to. Testing can however, be done outside the Software Development cycle too. &lt;br /&gt;
&lt;br /&gt;
Testing can be broadly classified into the following methodologies &amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
* '''Unit testing'''&lt;br /&gt;
* '''Integration testing'''&lt;br /&gt;
* '''Functional or Validation testing'''&lt;br /&gt;
* '''System testing'''&lt;br /&gt;
&lt;br /&gt;
The various testing processes/methods listed can be put in chronological order and can be viewed as a chain process. Each phase is an important part of the overall testing process. Unit test concentrates on the basic building blocks of the product, verifying if each component works correctly. The next phase is the Integration Testing. When many such units are knit together to form a larger, more complex block, it becomes necessary to test if all the smaller units of the bigger block interact properly to implement the semantics of the bigger block, as desired. The process that follows this stage is the Functional or Validation testing. This phase focuses on the behavior and performance in most cases. The question asked here is “If all the complex blocks are properly integrated, are they producing the result which they are required to?” The last phase is the System Testing. This mostly deals with interaction on the hardware-software platform and/or integration of the product on a platform, as viewed from a higher level. Here we will focus our discussion on Integration and Functional Testing.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
Testing is a very important phase in the software development cycle. The cycle can either follow the ''Waterfall'' [http://en.wikipedia.org/wiki/Waterfall_model] model or the ''Spiral'' model [http://en.wikipedia.org/wiki/Spiral_model]. The latter mandates testing continuously as opposed to the former’s discrete phase. No software product is completely free of defects. No matter how much care the design team takes, its impossible to ensure that there are absolutely no bugs. This is where testing comes in. The goal of the testing process is to try and break the software.&lt;br /&gt;
&lt;br /&gt;
Considering a large project, individual modules or units maybe developed by different team or even outsourced to different companies. Each team would have tested their respective modules or units. When, however, these modules are integrated climbing a level up, further testing maybe required to ensure that these units interact with other in a way which does not break the product. An important point in the development plan is the decision on the interface of each module. A common interface eliminates most of the bugs, but a final integration test ensures that everything is clean. &lt;br /&gt;
&lt;br /&gt;
Making sure that the units or modules integrate with each other is not enough. The result produced by integrating the modules and the behavior exhibited after integration is another important aspect of the development plan. A software is designed with a certain behavior and functionality in mind. Functional testing deals with testing the product for functional issues. Its goal is to ensure that the product is doing what it was intended to do in the design phase.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]. Sometime Functional testing is also called as ''System Testing''.&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy:Latvian Technological Center[http://www.innovation.lv]]]A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering. A Practitioner Approach: New York: McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22085</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 iftesting</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22085"/>
		<updated>2009-09-27T22:59:47Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Integration and Function Testing and beyond ==&lt;br /&gt;
Software testing is the science of breaking software down. During testing we have one and only one aim to develop comprehensive test cases to find bugs in the software and get them fixed.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
* '''Planning'''&lt;br /&gt;
* '''Design'''&lt;br /&gt;
* '''Development'''&lt;br /&gt;
* '''Testing'''&lt;br /&gt;
* '''Release and Maintenance'''&lt;br /&gt;
&lt;br /&gt;
Each stage can be further broken down into a number of several stages. This article focuses on the Testing phase. Software testing can be defined as inspection or investigation of a product to ascertain its quality and verify if its semantics are implemented the way they are intended to. Testing can however, be done outside the Software Development cycle too. &lt;br /&gt;
&lt;br /&gt;
Testing can be broadly classified into the following methodologies &amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
* '''Unit testing'''&lt;br /&gt;
* '''Integration testing'''&lt;br /&gt;
* '''Functional or Validation testing'''&lt;br /&gt;
* '''System testing'''&lt;br /&gt;
&lt;br /&gt;
The various testing processes/methods listed can be put in chronological order and can be viewed as a chain process. Each phase is an important part of the overall testing process. Unit test concentrates on the basic building blocks of the product, verifying if each component works correctly. The next phase is the Integration Testing. When many such units are knit together to form a larger, more complex block, it becomes necessary to test if all the smaller units of the bigger block interact properly to implement the semantics of the bigger block, as desired. The process that follows this stage is the Functional or Validation testing. This phase focuses on the behavior and performance in most cases. The question asked here is “If all the complex blocks are properly integrated, are they producing the result which they are required to?” The last phase is the System Testing. This mostly deals with interaction on the hardware-software platform and/or integration of the product on a platform, as viewed from a higher level. Here we will focus our discussion on Integration and Functional Testing.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
Testing is a very important phase in the software development cycle. The cycle can either follow the ''Waterfall'' [http://en.wikipedia.org/wiki/Waterfall_model] model or the ''Spiral'' model [http://en.wikipedia.org/wiki/Spiral_model]. The latter mandates testing continuously as opposed to the former’s discrete phase. No software product is completely free of defects. No matter how much care the design team takes, its impossible to ensure that there are absolutely no bugs. This is where testing comes in. The goal of the testing process is to try and break the software.&lt;br /&gt;
&lt;br /&gt;
Considering a large project, individual modules or units maybe developed by different team or even outsourced to different companies. Each team would have tested their respective modules or units. When, however, these modules are integrated climbing a level up, further testing maybe required to ensure that these units interact with other in a way which does not break the product. An important point in the development plan is the decision on the interface of each module. A common interface eliminates most of the bugs, but a final integration test ensures that everything is clean. &lt;br /&gt;
&lt;br /&gt;
Making sure that the units or modules integrate with each other is not enough. The result produced by integrating the modules and the behavior exhibited after integration is another important aspect of the development plan. A software is designed with a certain behavior and functionality in mind. Functional testing deals with testing the product for functional issues. Its goal is to ensure that the product is doing what it was intended to do in the design phase.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test. [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy:Latvian Technological Center[http://www.innovation.lv]]]A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad'' [https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering. A Practitioner Approach: New York: McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://en.wikipedia.org/wiki/Waterfall_model&lt;br /&gt;
# http://en.wikipedia.org/wiki/Spiral_model&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22084</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 iftesting</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_iftesting&amp;diff=22084"/>
		<updated>2009-09-27T22:56:21Z</updated>

		<summary type="html">&lt;p&gt;Ird: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Integration and Function Testing and beyond ==&lt;br /&gt;
Software testing is the science of breaking software down. During testing we have one and only one aim to develop comprehensive test cases to find bugs in the software and get them fixed.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Every software product goes though a ''Software Process'' or more commonly known as ''Software Development Cycle''. The various stages in the cycle are: [[image:Sw_dev_cycle.jpg|thumb|300px|Waterfall model of Software Development Cycle. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;&lt;br /&gt;
* '''Planning'''&lt;br /&gt;
* '''Design'''&lt;br /&gt;
* '''Development'''&lt;br /&gt;
* '''Testing'''&lt;br /&gt;
* '''Release and Maintenance'''&lt;br /&gt;
&lt;br /&gt;
Each stage can be further broken down into a number of several stages. This article focuses on the Testing phase. Software testing can be defined as inspection or investigation of a product to ascertain its quality and verify if its semantics are implemented the way they are intended to. Testing can however, be done outside the Software Development cycle too. &lt;br /&gt;
&lt;br /&gt;
Testing can be broadly classified into the following methodologies &amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;:&lt;br /&gt;
* '''Unit testing'''&lt;br /&gt;
* '''Integration testing'''&lt;br /&gt;
* '''Functional or Validation testing'''&lt;br /&gt;
* '''System testing'''&lt;br /&gt;
&lt;br /&gt;
The various testing processes/methods listed can be put in chronological order and can be viewed as a chain process. Each phase is an important part of the overall testing process. Unit test concentrates on the basic building blocks of the product, verifying if each component works correctly. The next phase is the Integration Testing. When many such units are knit together to form a larger, more complex block, it becomes necessary to test if all the smaller units of the bigger block interact properly to implement the semantics of the bigger block, as desired. The process that follows this stage is the Functional or Validation testing. This phase focuses on the behavior and performance in most cases. The question asked here is “If all the complex blocks are properly integrated, are they producing the result which they are required to?” The last phase is the System Testing. This mostly deals with interaction on the hardware-software platform and/or integration of the product on a platform, as viewed from a higher level. Here we will focus our discussion on Integration and Functional Testing.&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
&lt;br /&gt;
Testing is a very important phase in the software development cycle. The cycle can either follow the ''Waterfall'' [http://en.wikipedia.org/wiki/Waterfall_model] model or the ''Spiral'' model [http://en.wikipedia.org/wiki/Spiral_model]. The latter mandates testing continuously as opposed to the former’s discrete phase. No software product is completely free of defects. No matter how much care the design team takes, its impossible to ensure that there are absolutely no bugs. This is where testing comes in. The goal of the testing process is to try and break the software.&lt;br /&gt;
&lt;br /&gt;
Considering a large project, individual modules or units maybe developed by different team or even outsourced to different companies. Each team would have tested their respective modules or units. When, however, these modules are integrated climbing a level up, further testing maybe required to ensure that these units interact with other in a way which does not break the product. An important point in the development plan is the decision on the interface of each module. A common interface eliminates most of the bugs, but a final integration test ensures that everything is clean. &lt;br /&gt;
&lt;br /&gt;
Making sure that the units or modules integrate with each other is not enough. The result produced by integrating the modules and the behavior exhibited after integration is another important aspect of the development plan. A software is designed with a certain behavior and functionality in mind. Functional testing deals with testing the product for functional issues. Its goal is to ensure that the product is doing what it was intended to do in the design phase.&lt;br /&gt;
&lt;br /&gt;
== Testing Methodologies ==&lt;br /&gt;
&lt;br /&gt;
=== Integration Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Integration testing is important considering the fact that the final product would be viewed as a single entity by the users/customers rather than a collection of separate units. There are two approaches to integration testing: Incremental and Non-incremental integration testing. The latter is usually more difficult since testing the program as a whole would unearth a lot of errors and fixing one error may introduce others. Integration testing can be performed though a variety of ways. Following is a list of the popular methods:&lt;br /&gt;
[[image:Top-down.jpg|thumb|300px|Top-down approach of Integration testing. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;&lt;br /&gt;
==== Top-down Testing ==== &lt;br /&gt;
&lt;br /&gt;
This is a type of incremental integration testing of the product/program. The name is self-explanatory which implies that the testing assumes a top-down approach where a chain of flow indicates the various paths. After identifying the paths, tests can either be performed horizontally or vertically along the path. Testing horizontally tests modules at the same level, while testing vertically tests a full path.&lt;br /&gt;
&lt;br /&gt;
Depending on whether the test is conducted horizontally or vertically, tests are performed on the modules along the path. Thus depending on the approach, tests are conducted as the modules are integrated. A good coding practice is to separate the data and control modules. The control path should be mostly concentrated in the main/top module. Hence, one advantage of using the vertical approach is that it tests a complete control path at an early stage of integration and thus this gives the development/design team more cushion to work on the modules and fix errors, if any. &lt;br /&gt;
&lt;br /&gt;
A top-down approach may be more time consuming than other methodologies, though. This is because, unless each module is tested chronologically, the bug maybe difficult to trace due to dependencies. While there exists a method to deal with this, viz., replacing the modules in each level with minimal functional test modules, it doesn’t give accurate results&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bottom-up Testing ====&lt;br /&gt;
[[image:Bottom-up.jpg|thumb|300px|Bottom-up approach of Integration testing. Image courtesy:Pressman, Roger S. Software Engineering: A Practitioner's Approach&amp;quot;, 2001 ''Fifth Ed.]]&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;&lt;br /&gt;
Bottom-up approach is another type of incremental testing where the testing tree is construction from bottom-up. In a way it can be considered as an incremental unit-test as the modules are integrated. Since the approach requires a lot of test modules, the smaller modules are usually grouped to form a meta-module. This is done horizontally so that meta-modules (clusters) are in parallel paths in the final tree. This is helpful, since any information about another meta-module in the same level is available at the same time as the meta-module in consideration is under test. This is important because parallel meta-modules may be dependent on one another&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Big Bang Approach ====&lt;br /&gt;
&lt;br /&gt;
This is arguably one of the more difficult tests. This approach involves bringing all the methods together and running test on the meta-module. This test can only be run when the product is in the final development stages. One advantage of this method is that it can be quickly performed. Since the test is done on almost complete sets, the test cases are usually more real-scenario like which translates to better testing. The biggest disadvantage of this method is however the manageability. The code-base is so large that it becomes difficult to ensure that everything is tested thoroughly. Also, fixing one part can affect other parts of the program. Integration and final testing become quite cumbersome if not handled properly.[http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing]&lt;br /&gt;
&lt;br /&gt;
==== Regression Testing ====&lt;br /&gt;
&lt;br /&gt;
Testing is a continuous process in the ''Spiral'' model and in fact, the same is encouraged in the ''Waterfall'' model, to test as soon as unit is completes the implementation phase. Regression test refers to the process of continuous test to the bigger meta-module as soon as a new model is added to ensure that the overall cluster is working as intended. While Regression testing may not be strictly classified as an Integration test, it fits in here well.[http://www.cs.umd.edu/~aporter/html/currTesting.html]&lt;br /&gt;
&lt;br /&gt;
Bug-fixing in one part of the module may lead to a bug in another part of the same module. To ensure everything works smoothly, the tests need to be run again on modules that had previously passed the tests. Hence Regression Test in an integral part of the testing phase and an important too. A complex can have a very large set of regression tests. It is always a good idea to categorize the regression test and have one test representing a category.&lt;br /&gt;
&lt;br /&gt;
There are no hard and fast rules about the Integration testing method to be used. Some software packages may benefit from Top-down approach while for some, Bottom-up may be more feasible. Sandwich-method – which is like “best of both worlds” is often employed for different stages of a product. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Functional Testing and beyond ===&lt;br /&gt;
&lt;br /&gt;
Functional testing maybe thought as a part of the ''Quality Control program''. Functional test is very important since it validates that the product behaves and works, as it was intended to, during the design phase. Functional test is like an accuracy test. [https://wiki.cac.washington.edu/display/SWTest/Functional+Testing]&lt;br /&gt;
&lt;br /&gt;
A lot of people are confused between ''Functional'' and ''Unit testing''. The main thing that differentiates Functional testing from Unit testing is the order of tests conducted. If the order of the module tests is immaterial to the final outcome then the test can be classified as a Unit test, since in a Functional test the final outcome is dependent on the intermediate test results. &lt;br /&gt;
&lt;br /&gt;
During functional testing it is required that the testing team have the ''Design Specification'' so that the results can be validated. The software may also be tested for some performance metric, which also qualifies as functional testing. The Functional testing phase must have definite test plan which includes the process that needs to be carried out as well as deliverables. Also, since this test evaluates the overall behavior of the product, a scope must be defined so that there are a logical number of test cases. [http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing]&lt;br /&gt;
&lt;br /&gt;
==== Functional Decomposition and Blackbox testing ====&lt;br /&gt;
&lt;br /&gt;
A very practical approach to functional testing is to break down the big block into smaller functional blocks. This way, it’s possible to catch a bug at an early stage before it propagates deeper into the tree, where it can be a really difficult process. This breakdown is termed Functional Decomposition. The testing team must also maintain Traceability. This refers to the fact that each test cases or a group of test cases can be associated with certain functional requirement. It would be incorrect to map all the test cases to the same requirement. This further raises the question: Does failure of one test mean, failure to satisfy the requirement? The answer to this question can only be given if a subset of tests is mapped to a certain requirement. This is one aspect that is overlooked by many testing teams.&lt;br /&gt;
&lt;br /&gt;
[[image:Blackbox.gif|thumb|300px|Black-box testing. Image courtesy:Latvian Technological Center[http://www.innovation.lv]]]A common testing strategy employed for functional testing is the ''Blackbox testing''. In this testing strategy, the testing team does not need to be aware of the internal semantics of the product. Instead the team must know what inputs will product what outputs. This eliminates much of the complexity involved in understanding the logic. The higher the level of the meta-module, the bigger the Blackbox. The biggest advantage is that the core development team need not give implementation specific details to the testing team, if outsourced. This is also time saving. One disadvantage however, is that the number of test cases increases exponentially as the meta-module become more and more complex.&lt;br /&gt;
&lt;br /&gt;
==== Bug Tracking Systems ====&lt;br /&gt;
&lt;br /&gt;
A popular way of functional test tracking is by using ''Bug-Tracking Systems''. A popular open-source BTS is ''BugZilla'' [http://www.bugzilla.org/] developed and used my Mozilla. Another example of a BTS is ''Launchpad''[https://launchpad.net/]. Popular projects like ''Ubuntu GNU/Linux'', ''Nautilus'' etc. make use of ''Launchpad'' for bug tracking and functional testing. The database of the bug-tracking system is probably the most important part of the BTS. Releasing the software in alpha or beta version is a common practice in the software industry for testing of the same by a much larger audience.&lt;br /&gt;
&lt;br /&gt;
Documentation is a very important aspect of testing. A periodic report of the tests conducted, results and related comments must be maintained so that the design team is aware of the improvements to be made. This document can include Coverage analysis at the very least.&lt;br /&gt;
&lt;br /&gt;
== Testing Tools ==&lt;br /&gt;
&lt;br /&gt;
A number of testing tools and suites are available today, which help in integration and functional testing. A discussion on them is beyond the scope of this wiki but the reader is free to explore. Here are some links that the reader may find useful: &lt;br /&gt;
&lt;br /&gt;
* [http://www.eclipse.org/tptp Eclipse TPTP]&lt;br /&gt;
* [http://sourceforge.net/projects/webunitproj Enterprise Web Test]&lt;br /&gt;
* [http://ldtp.freedesktop.org GNU/Linux Desktop Testing Project]&lt;br /&gt;
* [http://xmltestsuite.sourceforge.net/ XML Test Suite]&lt;br /&gt;
* [http://valgrind.org/ Valgrind]&lt;br /&gt;
* [http://www.webload.org/ WebLOAD]&lt;br /&gt;
* [http://jakarta.apache.org/jmeter/ Apache JMeter]&lt;br /&gt;
* [http://www.manageengine.com/products/qengine/ QEngine]&lt;br /&gt;
&lt;br /&gt;
More opensource tools may be found [http://www.opensourcetesting.org here].&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Software Testing is relatively a new field and we have only just began to develop a systematic approach to it. The scope of research and innovation in this new field is limitless and with the advances in support for testing tools the process is getting more formalized and automated day by day. Nevertheless one thing is guaranteed that a software can never be guaranteed to be bug free and every time a customer uses it, it will undergo yet another test.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
# [http://www.mhhe.com/engcs/compsci/pressman/index.mhtml R. S. Pressman. Software Engineering. A Practitioner Approach: New York: McGraw-Hill, 2001, p386-p429.]&lt;br /&gt;
# http://www.devbistro.com/articles/Testing/Requirements-Based-Functional-Testing&lt;br /&gt;
# https://wiki.cac.washington.edu/display/SWTest/Functional+Testing&lt;br /&gt;
# http://docs.joomla.org/Functional_Testing&lt;br /&gt;
# http://www.opensourcetesting.org/&lt;br /&gt;
# http://www.bugzilla.org/&lt;br /&gt;
# https://launchpad.net/&lt;br /&gt;
# http://www.cs.umd.edu/~aporter/html/currTesting.html&lt;br /&gt;
# http://www.testinggeek.com/index.php/testing-types/life-cycle/55-bigbang-integration-testing&lt;/div&gt;</summary>
		<author><name>Ird</name></author>
	</entry>
</feed>