<?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=Mjampal</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=Mjampal"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Mjampal"/>
	<updated>2026-09-13T01:02:47Z</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_17_am&amp;diff=30072</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 17 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_17_am&amp;diff=30072"/>
		<updated>2009-12-01T06:12:53Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Conclusions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
Traditional methods do not provide a solution to the SCP violations. Inheritance related concepts of [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 Dynamic binding] provide the solution to this problem.&lt;br /&gt;
&lt;br /&gt;
The graphics system given above can be reimplemented in the Object Oriented Manner as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class CIRCLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class SQUARE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class RECTANGLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
  end&lt;br /&gt;
end  &lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
Thus a new sub class of shape is created for each new type of shape. The function display_details to be called depends upon the type of the invoking object. Thus the list of switch case / if else statements would only be needed while creating the object. Further on no such statements have to be written for any of the other operations such as computing the area, rendering to a GUI or checking for overlap with another shape, etc., etc.&lt;br /&gt;
&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices, which contrasts the modularity goal which suggests that &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module should have this knowledge.&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the [http://en.wikipedia.org/wiki/Open/closed_principle Open Closed Principle].&lt;br /&gt;
# SCP is a strong form of [http://en.wikipedia.org/wiki/Information_hiding Information Hiding]. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
# Object-Oriented Software Construction Second Edition, Bertrand Meyer pg 62-64.&lt;br /&gt;
# [http://c2.com/cgi/wiki?SingleChoicePrinciple Single Choice Principle]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_17_am&amp;diff=30071</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 17 am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_17_am&amp;diff=30071"/>
		<updated>2009-12-01T06:12:21Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
Traditional methods do not provide a solution to the SCP violations. Inheritance related concepts of [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 Dynamic binding] provide the solution to this problem.&lt;br /&gt;
&lt;br /&gt;
The graphics system given above can be reimplemented in the Object Oriented Manner as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class CIRCLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class SQUARE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class RECTANGLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
  end&lt;br /&gt;
end  &lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
Thus a new sub class of shape is created for each new type of shape. The function display_details to be called depends upon the type of the invoking object. Thus the list of switch case / if else statements would only be needed while creating the object. Further on no such statements have to be written for any of the other operations such as computing the area, rendering to a GUI or checking for overlap with another shape, etc., etc.&lt;br /&gt;
&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices, which contrasts the modularity goal which suggests that &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module should have this knowledge.&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the [http://en.wikipedia.org/wiki/Open/closed_principle Open Closed Principle].&lt;br /&gt;
# SCP is a strong form of [http://en.wikipedia.org/wiki/Information_hiding Information Hiding]. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusions===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
# Object-Oriented Software Construction Second Edition, Bertrand Meyer pg 62-64.&lt;br /&gt;
# [http://c2.com/cgi/wiki?SingleChoicePrinciple Single Choice Principle]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28489</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 7 Single Choice Pattern am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28489"/>
		<updated>2009-11-18T19:04:03Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
Traditional methods do not provide a solution to the SCP violations. Inheritance related concepts of [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 Dynamic binding] provide the solution to this problem.&lt;br /&gt;
&lt;br /&gt;
The graphics system given above can be reimplemented in the Object Oriented Manner as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class CIRCLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class SQUARE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class RECTANGLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
  end&lt;br /&gt;
end  &lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
Thus a new sub class of shape is created for each new type of shape. The function display_details to be called depends upon the type of the invoking object. Thus the list of switch case / if else statements would only be needed while creating the object. Further on no such statements have to be written for any of the other operations such as computing the area, rendering to a GUI or checking for overlap with another shape, etc., etc.&lt;br /&gt;
&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices, which contrasts the modularity goal which suggests that &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module should have this knowledge.&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the [http://en.wikipedia.org/wiki/Open/closed_principle Open Closed Principle].&lt;br /&gt;
# SCP is a strong form of [http://en.wikipedia.org/wiki/Information_hiding Information Hiding]. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
# Object-Oriented Software Construction Second Edition, Bertrand Meyer pg 62-64.&lt;br /&gt;
# [http://c2.com/cgi/wiki?SingleChoicePrinciple Single Choice Principle]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28482</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 7 Single Choice Pattern am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28482"/>
		<updated>2009-11-18T19:00:32Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Other Highlights */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
Traditional methods do not provide a solution to the SCP violations. Inheritance related concepts of [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 Dynamic binding] provide the solution to this problem.&lt;br /&gt;
&lt;br /&gt;
The graphics system given above can be reimplemented in the Object Oriented Manner as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class CIRCLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class SQUARE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class RECTANGLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
  end&lt;br /&gt;
end  &lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
Thus a new sub class of shape is created for each new type of shape. The function display_details to be called depends upon the type of the invoking object. Thus the list of switch case / if else statements would only be needed while creating the object. Further on no such statements have to be written for any of the other operations such as computing the area, rendering to a GUI or checking for overlap with another shape, etc., etc.&lt;br /&gt;
&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices, which contrasts the modularity goal which suggests that &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module should have this knowledge.&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the [http://en.wikipedia.org/wiki/Open/closed_principle Open Closed Principle].&lt;br /&gt;
# SCP is a strong form of [http://en.wikipedia.org/wiki/Information_hiding Information Hiding]. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28480</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 7 Single Choice Pattern am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28480"/>
		<updated>2009-11-18T18:59:21Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Implementation of SCP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
Traditional methods do not provide a solution to the SCP violations. Inheritance related concepts of [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 Dynamic binding] provide the solution to this problem.&lt;br /&gt;
&lt;br /&gt;
The graphics system given above can be reimplemented in the Object Oriented Manner as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class CIRCLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class SQUARE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class RECTANGLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
  end&lt;br /&gt;
end  &lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
Thus a new sub class of shape is created for each new type of shape. The function display_details to be called depends upon the type of the invoking object. Thus the list of switch case / if else statements would only be needed while creating the object. Further on no such statements have to be written for any of the other operations such as computing the area, rendering to a GUI or checking for overlap with another shape, etc., etc.&lt;br /&gt;
&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices contrasting the modularity goal that suggests &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module to have this knowledge&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the [http://en.wikipedia.org/wiki/Open/closed_principle Open Closed Principle].&lt;br /&gt;
# SCP is a strong form of [http://en.wikipedia.org/wiki/Information_hiding Information Hiding]. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28470</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 7 Single Choice Pattern am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28470"/>
		<updated>2009-11-18T18:51:34Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Implementation of SCP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
Traditional methods do not provide a solution to the SCP violations. Inheritance related concepts of [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and [http://en.wikipedia.org/wiki/Dynamic_binding_%28computer_science%29 Dynamic binding] provide the solution to this problem.&lt;br /&gt;
&lt;br /&gt;
For the graphics system given above can be reimplemented in the Object Oriented Method as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class CIRCLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class SQUARE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class RECTANGLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
  end&lt;br /&gt;
end  &lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
Thus a new sub class of shape is created for each new type of shape. The function display_details to be called depends upon the type of the invoking object. Thus the list of switch case/if else statements would only be needed while creating the object. Further on no such statements have to be written for any of the other operations such as computing the area, rendering to a GUI or checking for overlap with another shape, etc., etc.&lt;br /&gt;
&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices contrasting the modularity goal that suggests &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module to have this knowledge&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the [http://en.wikipedia.org/wiki/Open/closed_principle Open Closed Principle].&lt;br /&gt;
# SCP is a strong form of [http://en.wikipedia.org/wiki/Information_hiding Information Hiding]. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28468</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 7 Single Choice Pattern am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28468"/>
		<updated>2009-11-18T18:49:39Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Other Highlights */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
Traditional methods do not provide a solution to the SCP violations. Inheritance related concepts of polymorphism and Dynamic binding provide the solution to this problem.&lt;br /&gt;
&lt;br /&gt;
For the graphics system given above can be reimplemented in the Object Oriented Method as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class CIRCLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class SQUARE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class RECTANGLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
  end&lt;br /&gt;
end  &lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
Thus a new sub class of shape is created for each new type of shape. The function display_details to be called depends upon the type of the invoking object. Thus the list of switch case/if else statements would only be needed while creating the object. Further on no such statements have to be written for any of the other operations such as computing the area, rendering to a GUI or checking for overlap with another shape, etc., etc.&lt;br /&gt;
&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices contrasting the modularity goal that suggests &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module to have this knowledge&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the [http://en.wikipedia.org/wiki/Open/closed_principle Open Closed Principle].&lt;br /&gt;
# SCP is a strong form of [http://en.wikipedia.org/wiki/Information_hiding Information Hiding]. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28455</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 7 Single Choice Pattern am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28455"/>
		<updated>2009-11-18T18:31:50Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Implementation of SCP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
Traditional methods do not provide a solution to the SCP violations. Inheritance related concepts of polymorphism and Dynamic binding provide the solution to this problem.&lt;br /&gt;
&lt;br /&gt;
For the graphics system given above can be reimplemented in the Object Oriented Method as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class CIRCLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class SQUARE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class RECTANGLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
  end&lt;br /&gt;
end  &lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
Thus a new sub class of shape is created for each new type of shape. The function display_details to be called depends upon the type of the invoking object. Thus the list of switch case/if else statements would only be needed while creating the object. Further on no such statements have to be written for any of the other operations such as computing the area, rendering to a GUI or checking for overlap with another shape, etc., etc.&lt;br /&gt;
&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices contrasting the modularity goal that suggests &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module to have this knowledge&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the Open Closed Principle.&lt;br /&gt;
# SCP is a strong form of Information Hiding. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28440</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 7 Single Choice Pattern am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28440"/>
		<updated>2009-11-18T17:59:12Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Implementation of SCP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
Traditional methods do not provide a solution to the SCP violations. Inheritance related concepts of polymorphism and Dynamic binding provide the solution to this problem.&lt;br /&gt;
&lt;br /&gt;
For the graphics system given above can be reimplemented in the Object Oriented Method as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class CIRCLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class SQUARE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class RECTANGLE &amp;lt; SHAPE&lt;br /&gt;
  display_details&lt;br /&gt;
    print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
  end&lt;br /&gt;
end  &lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
Thus a new sub class of shape is created for each new type of shape.&lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.&lt;br /&gt;
&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices contrasting the modularity goal that suggests &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module to have this knowledge&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the Open Closed Principle.&lt;br /&gt;
# SCP is a strong form of Information Hiding. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28430</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 7 Single Choice Pattern am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28430"/>
		<updated>2009-11-18T17:47:39Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Implementation of SCP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
Traditional methods do not provide a solution to the SCP violations. Inheritance related concepts of polymorphism and Dynamic binding provide the solution to this problem.&lt;br /&gt;
&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices contrasting the modularity goal that suggests &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module to have this knowledge&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the Open Closed Principle.&lt;br /&gt;
# SCP is a strong form of Information Hiding. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28420</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 7 Single Choice Pattern am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28420"/>
		<updated>2009-11-18T17:35:11Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Other Highlights */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices contrasting the modularity goal that suggests &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module to have this knowledge&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# SCP is a direct consequence of the Open Closed Principle.&lt;br /&gt;
# SCP is a strong form of Information Hiding. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28418</id>
		<title>CSC/ECE 517 Fall 2009/wiki3 7 Single Choice Pattern am</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki3_7_Single_Choice_Pattern_am&amp;diff=28418"/>
		<updated>2009-11-18T17:34:04Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Other Highlights */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Single Choice Principle'''==&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
Single Choice Principle states that whenever a software system must support a set of alternatives, one and only one module in the system should know their exhaustive list. It is one of the five principles of software construction as stated by Bertrand Meyer, the other four being the [http://hebb.cis.uoguelph.ca/~dave/343/Lectures/swquality.html#linguistic Linguistic Modular Units Principle], the Self- Documentation Principle, the [http://en.wikipedia.org/wiki/Uniform_access_principle Uniform- Access Principle], and the [http://en.wikipedia.org/wiki/Open/closed_principle Open- Closed Principle]. The Single Choice Principle may be viewed as a consequence of both the Open-Closed and information Hiding rules. It was applied when designing [http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 Eiffel].This principle is a particular case of the [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Don't repeat yourself principle].&lt;br /&gt;
&lt;br /&gt;
===Violation of SCP===&lt;br /&gt;
&lt;br /&gt;
Consider a  type used to manage a declared in Pascal-Ada syntax : &lt;br /&gt;
&amp;lt;pre&amp;gt;Type Publication=&lt;br /&gt;
	record&lt;br /&gt;
		author,title:STRING;&lt;br /&gt;
		publication_year:INTEGER;&lt;br /&gt;
	case 	pubtype: (book,journal,conference_proceedings)of&lt;br /&gt;
		book: (publisher:STRING);&lt;br /&gt;
		journal: (volume,issue:STRING);&lt;br /&gt;
		proceedings: (editor, place:STRING) – Conference proceedings&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
Let B be a typical client of A. B will manipulate publications through a variable such as &lt;br /&gt;
p:PUBLICATION&lt;br /&gt;
and to do anything useful with p, will need to discriminate explicitly between the various cases, as in:&lt;br /&gt;
&amp;lt;pre&amp;gt;	case p of &lt;br /&gt;
		book:...Instructions which may access the field p.publisher&lt;br /&gt;
		journal:...Instructions which may access fields p.volume,p.issue&lt;br /&gt;
		proceedings:...Instructions which may access fields p.editor,p.place&lt;br /&gt;
	end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, whenever there is a need for a new variant, say technical reports of companies in this case, there is a need to extend the definition of type PUBLICATION in module A to support the new case, as well as  any client of A, such as B, will also require updating if it is used as a structure such as above, relying on an explicit list of cases for p.&lt;br /&gt;
What is observed is a violation of the SCP and is a disastrous situation for software change and evolution as a simple and natural addition may cause a chain reaction of changes across many client changes. This violation will occur whenever a certain notion admits a number of variants for ex. -&lt;br /&gt;
&lt;br /&gt;
*In graphics system: the notion of figure, with such variants as polygon, circle, ellipse, and other basic figure types.&lt;br /&gt;
&amp;lt;pre&amp;gt;For example old style procedural code to print different &amp;quot;shape&amp;quot; objects might read:&lt;br /&gt;
&lt;br /&gt;
 if (type==CIRCLE)&lt;br /&gt;
   print &amp;quot;Circle.  r=&amp;quot; + radius;&lt;br /&gt;
 else if (type==Square)&lt;br /&gt;
   print &amp;quot;Square.  sides=&amp;quot; + sideLength;&lt;br /&gt;
 else if (type==Rectangle)&lt;br /&gt;
   print &amp;quot;Rect.  h=&amp;quot; + height + &amp;quot; w=&amp;quot; + width;&lt;br /&gt;
 endif&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This same list of alternatives would be used in computing the area, and it rendering to a GUI and in checking for overlap with another shape, etc., etc. So these lists of cases  have to be modified in all locations whenever you add a new shape.        &lt;br /&gt;
&lt;br /&gt;
*In a text editor: the notion of user command, with such variants as line insertion, line deletion, character deletion.&lt;br /&gt;
*In a compiler for a programming language, the notion of language construct, with such variants as instruction, expression, procedure.&lt;br /&gt;
&lt;br /&gt;
===Implementation of SCP===&lt;br /&gt;
===Other Highlights===&lt;br /&gt;
# According to the Single Choice principle exactly one module should know the list of choices contrasting the modularity goal that suggests &amp;lt;i&amp;gt;at most one&amp;lt;/i&amp;gt; module to have this knowledge&lt;br /&gt;
# The principle is about distribution of knowledge in a software system. The amount of information available to each module should be limited to the information that is required for its proper functioning. This can analogous to the &amp;quot;need-to-know&amp;quot; policy. That is, a module only knows that much as it needs to know.&lt;br /&gt;
# Single Choice Principle is a direct consequence of the Open Closed Principle.&lt;br /&gt;
# Single Choice Principle is a strong form of Information Hiding. The module containing the list of choices tries to hide it from the the other modules.&lt;br /&gt;
&lt;br /&gt;
===Conclusion===&lt;br /&gt;
The single choice principle is a principle of [http://en.wikipedia.org/wiki/Imperative_programming imperative] [http://en.wikipedia.org/wiki/Computer_programming computer programming].It directs us to limit the dissemination of exhaustive knowledge about variants of a certain notion. It is an impetus to [http://en.wikipedia.org/wiki/Polymorphism polymorphism] and aims at achieving high [http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29 cohesion] and low [http://en.wikipedia.org/wiki/Coupling_%28computer_science%29 coupling], one of the most important aspects of [http://en.wikipedia.org/wiki/Modular_programming Modular Programming].&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23181</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23181"/>
		<updated>2009-10-08T22:19:49Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Appendix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Metaprogramming =&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter.&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.'' Source: [http://en.wikipedia.org/wiki/Metaprogramming]&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
Source: [http://c2.com/cgi/wiki?MetaProgramming]&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
==== What makes Ruby good for metaprogramming ====&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*An easy syntax&lt;br /&gt;
&lt;br /&gt;
==== Classification of metaprogramming features in Ruby ====&lt;br /&gt;
* The dynamic nature of Ruby supports creating classes and methods at runtime&lt;br /&gt;
* Methods can be defined directly on Singleton classes: class_eval can be used to define methods on singleton classes. This will then modify the behaviour of the sub classes(if any) and not the base class.&lt;br /&gt;
* Blocks and proc objects: Materializing a Proc and saving this in variables and sending it around is a good way to use metaprogramming to do interesting things. Lambda function is used to define proc objects &lt;br /&gt;
* The different evals: There are 4 different evals in Ruby &lt;br /&gt;
** eval: This call can take a string or binding to evaluate but not a block&lt;br /&gt;
** class_eval: It is just a alias for module_eval&lt;br /&gt;
** instance_eval: It will evaluate the string or the block in the context of the receiver. Thus it sets self to be the receiver.&lt;br /&gt;
** module_eval: It will evaluate the string or the block in the context of the module it is called on. Thus it is used to define new methods on singleton classes. This is the most commonly used eval call.&lt;br /&gt;
&lt;br /&gt;
The difference between the above 4 evals can be understood with examples [http://www.elctech.com/snippets/the-difference-between-eval-class_eval-module_eval-and-instance_eval here]. Another useful external link on evals can be found [http://4loc.wordpress.com/2009/05/29/eval-module_eval-and-instance_eval/ here]&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
We begin by showing how methods can be defined dynamically in Ruby. Consider we need a method that duplicates strings eg. &amp;quot;foo&amp;quot;.duplicate -&amp;gt; &amp;quot;foofoo&amp;quot;. And a deduplicate method for removing duplication eg. &amp;quot;foofoo&amp;quot;.deduplicate -&amp;gt; &amp;quot;foo&amp;quot;. We can define such methods dynamically in Ruby. This ''dynamic'' feature in Ruby forms the simplest kind of metapgrogramming. &lt;br /&gt;
&lt;br /&gt;
 class String&lt;br /&gt;
  def duplicate&lt;br /&gt;
   self * 2&lt;br /&gt;
  end&lt;br /&gt;
  def deduplicate&lt;br /&gt;
   self[0, self.length/2]&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. ''These methods are written in C''. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#Appendix Appendix]. Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Consider how define_method can be used dynamically in Ruby&lt;br /&gt;
 Eagle=Class.new&lt;br /&gt;
 e=Eagle.new&lt;br /&gt;
 class Eagle&lt;br /&gt;
  define_method:fly do&lt;br /&gt;
   puts &amp;quot;I am flying&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 e.fly&lt;br /&gt;
 Output: ''I am flying''&lt;br /&gt;
&lt;br /&gt;
Rails becomes an all-powerful MVC framework, thanks to the metaprogramming features in Ruby.&lt;br /&gt;
&lt;br /&gt;
''Other elaborate examples can be found in the [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#References References] section of this wiki page. A detailed discussion on Metaprogramming in Ruby was done in the CSC517 course lecture, the notes for which can be found [http://courses.ncsu.edu/csc517/common/lectures/notes/lec12-f09.pdf here]''&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of [http://en.wikipedia.org/wiki/Name_binding early binding].  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
'''Calculating a value at compile time''' &amp;lt;br&amp;gt;&lt;br /&gt;
The code to find summation of a number without using templates can be given as:  &amp;lt;br&amp;gt;&lt;br /&gt;
 int summation(int n) &lt;br /&gt;
 {&lt;br /&gt;
     if (n == 0 )&lt;br /&gt;
        return 0;&lt;br /&gt;
     return n + summation(n - 1);&lt;br /&gt;
 }&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
     int b = summation(0);  //b=0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&lt;br /&gt;
 template &amp;lt;int N&amp;gt;&lt;br /&gt;
 //TEMPLATE DEFINITION&lt;br /&gt;
 struct Summation&lt;br /&gt;
 {&lt;br /&gt;
     enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
 };&lt;br /&gt;
 template &amp;lt;&amp;gt;&lt;br /&gt;
 struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
 {&lt;br /&gt;
     enum { value = 0 };&lt;br /&gt;
 };&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
     int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
'''Loop unrolling''' &amp;lt;br&amp;gt; &lt;br /&gt;
Further templates can be used to unroll loops, that is a loop is replaced by repeating the code within the loop a certain number of times. [http://www.codeproject.com/KB/cpp/crc_meta.aspx more on this example]&lt;br /&gt;
&lt;br /&gt;
 template&amp;lt; int i &amp;gt;&lt;br /&gt;
 class LOOP{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
             LOOP&amp;lt; i-1 &amp;gt;::EXEC();&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class LOOP&amp;lt; 0 &amp;gt;{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
The output of LOOP&amp;lt; 8 &amp;gt;::EXEC() is shown below: &amp;lt;br&amp;gt;&lt;br /&gt;
A-8 A-7 A-6 A-5 A-4 A-3 A-2 A-1 A-0 &amp;lt;br&amp;gt;&lt;br /&gt;
B-0 B-1 B-2 B-3 B-4 B-5 B-6 B-7 B-8 &amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
At compile time the loop unrolls itself and produces the following lines of code:&lt;br /&gt;
&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
More Examples can be found at [http://en.wikibooks.org/wiki/C++_Programming/Template/Template_Meta-Programming C++ Template Programming], [http://en.wikipedia.org/wiki/Template_metaprogramming Template Metaprogramming] and [http://www.codeproject.com/KB/cpp/crc_meta.aspx TMP in c++]&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete [http://homepage.mac.com/sigfpe/Computing/peano.html]. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Metaprogramming is thus an essential and useful programming feature that allows elimination of duplicated code and enables clean execution with lesser lines of code. The style of metaprogramming differs when it comes to different languages. Ruby and Lisp have more specialized metaprogramming constructs as compared to Java or C++. Metaprogramming is apparently is a higher-level concept and probably used often by expert programmers, nevertheless through metaprogramming the overall code or program becomes very easy to interpret. Its a trade-off that should be balanced by software programmers.&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
* Template: A feature of the C++ programming language that allow functions and classes to operate with generic types. This allows a function or class to work on many different data types without being rewritten for each one.&lt;br /&gt;
* Early Binding: In programming languages, name binding is the association of values with identifiers. The binding of names before the program is run is called early (also &amp;quot;static&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
== References/External Links ==&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Metaprogramming Wikipedia article on metaprogramming]&lt;br /&gt;
# [http://c2.com/cgi/wiki?MetaProgramming Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx Template programming in C++]&lt;br /&gt;
# [http://homepage.mac.com/sigfpe/Computing/peano.html Turing completeness in C++]&lt;br /&gt;
# [http://www.vanderburg.org/Speaking/Stuff/oscon05.pdf presentation about Meta programming in Ruby made at the 2005 O’Reilly Open Source Convention by Glenn Vanderburg] &lt;br /&gt;
# [http://theplana.wordpress.com/2007/03/12/how-to-define-a-attribute-using-metaprogramming/ Defining attributes with Metaprogramming]&lt;br /&gt;
# More examples on Ruby metaprogramming&lt;br /&gt;
## [http://ozone.wordpress.com/2006/03/02/binary-search-tree-sauce-ruby-part-1/ Link 1]&lt;br /&gt;
## [http://www.ruby-doc.org/core/classes/Object.src/M000366.html Link 2]&lt;br /&gt;
## [http://expressica.com/category/metaprogramming/ Link 3]&lt;br /&gt;
# [http://ozone.wordpress.com/2006/02/22/rubybeans-a-short-example-of-ruby-metaprogramming/#comment-1286 Rubybeans and Metaprogramming]&lt;br /&gt;
# [http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-metaprogramming.html Metaprogramming in Ruby]&lt;br /&gt;
# [http://en.wikibooks.org/wiki/C++_Programming/Template/Template_Meta-Programming C++ Template Programming]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Template_metaprogramming Template Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx TMP in c++]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23179</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23179"/>
		<updated>2009-10-08T22:12:32Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Appendix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Metaprogramming =&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter.&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.'' Source: [http://en.wikipedia.org/wiki/Metaprogramming]&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
Source: [http://c2.com/cgi/wiki?MetaProgramming]&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
==== What makes Ruby good for metaprogramming ====&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*An easy syntax&lt;br /&gt;
&lt;br /&gt;
==== Classification of metaprogramming features in Ruby ====&lt;br /&gt;
* The dynamic nature of Ruby supports creating classes and methods at runtime&lt;br /&gt;
* Methods can be defined directly on Singleton classes: class_eval can be used to define methods on singleton classes. This will then modify the behaviour of the sub classes(if any) and not the base class.&lt;br /&gt;
* Blocks and proc objects: Materializing a Proc and saving this in variables and sending it around is a good way to use metaprogramming to do interesting things. Lambda function is used to define proc objects &lt;br /&gt;
* The different evals: There are 4 different evals in Ruby &lt;br /&gt;
** eval: This call can take a string or binding to evaluate but not a block&lt;br /&gt;
** class_eval: It is just a alias for module_eval&lt;br /&gt;
** instance_eval: It will evaluate the string or the block in the context of the receiver. Thus it sets self to be the receiver.&lt;br /&gt;
** module_eval: It will evaluate the string or the block in the context of the module it is called on. Thus it is used to define new methods on singleton classes. This is the most commonly used eval call.&lt;br /&gt;
&lt;br /&gt;
The difference between the above 4 evals can be understood with examples [http://www.elctech.com/snippets/the-difference-between-eval-class_eval-module_eval-and-instance_eval here]. Another useful external link on evals can be found [http://4loc.wordpress.com/2009/05/29/eval-module_eval-and-instance_eval/ here]&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
We begin by showing how methods can be defined dynamically in Ruby. Consider we need a method that duplicates strings eg. &amp;quot;foo&amp;quot;.duplicate -&amp;gt; &amp;quot;foofoo&amp;quot;. And a deduplicate method for removing duplication eg. &amp;quot;foofoo&amp;quot;.deduplicate -&amp;gt; &amp;quot;foo&amp;quot;. We can define such methods dynamically in Ruby. This ''dynamic'' feature in Ruby forms the simplest kind of metapgrogramming. &lt;br /&gt;
&lt;br /&gt;
 class String&lt;br /&gt;
  def duplicate&lt;br /&gt;
   self * 2&lt;br /&gt;
  end&lt;br /&gt;
  def deduplicate&lt;br /&gt;
   self[0, self.length/2]&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. ''These methods are written in C''. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#Appendix Appendix]. Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Consider how define_method can be used dynamically in Ruby&lt;br /&gt;
 Eagle=Class.new&lt;br /&gt;
 e=Eagle.new&lt;br /&gt;
 class Eagle&lt;br /&gt;
  define_method:fly do&lt;br /&gt;
   puts &amp;quot;I am flying&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 e.fly&lt;br /&gt;
 Output: ''I am flying''&lt;br /&gt;
&lt;br /&gt;
Rails becomes an all-powerful MVC framework, thanks to the metaprogramming features in Ruby.&lt;br /&gt;
&lt;br /&gt;
''Other elaborate examples can be found in the [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#References References] section of this wiki page. A detailed discussion on Metaprogramming in Ruby was done in the CSC517 course lecture, the notes for which can be found [http://courses.ncsu.edu/csc517/common/lectures/notes/lec12-f09.pdf here]''&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of [http://en.wikipedia.org/wiki/Name_binding early binding].  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
'''Calculating a value at compile time''' &amp;lt;br&amp;gt;&lt;br /&gt;
The code to find summation of a number without using templates can be given as:  &amp;lt;br&amp;gt;&lt;br /&gt;
 int summation(int n) &lt;br /&gt;
 {&lt;br /&gt;
     if (n == 0 )&lt;br /&gt;
        return 0;&lt;br /&gt;
     return n + summation(n - 1);&lt;br /&gt;
 }&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
     int b = summation(0);  //b=0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&lt;br /&gt;
 template &amp;lt;int N&amp;gt;&lt;br /&gt;
 //TEMPLATE DEFINITION&lt;br /&gt;
 struct Summation&lt;br /&gt;
 {&lt;br /&gt;
     enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
 };&lt;br /&gt;
 template &amp;lt;&amp;gt;&lt;br /&gt;
 struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
 {&lt;br /&gt;
     enum { value = 0 };&lt;br /&gt;
 };&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
     int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
'''Loop unrolling''' &amp;lt;br&amp;gt; &lt;br /&gt;
Further templates can be used to unroll loops, that is a loop is replaced by repeating the code within the loop a certain number of times. [http://www.codeproject.com/KB/cpp/crc_meta.aspx more on this example]&lt;br /&gt;
&lt;br /&gt;
 template&amp;lt; int i &amp;gt;&lt;br /&gt;
 class LOOP{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
             LOOP&amp;lt; i-1 &amp;gt;::EXEC();&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class LOOP&amp;lt; 0 &amp;gt;{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
The output of LOOP&amp;lt; 8 &amp;gt;::EXEC() is shown below: &amp;lt;br&amp;gt;&lt;br /&gt;
A-8 A-7 A-6 A-5 A-4 A-3 A-2 A-1 A-0 &amp;lt;br&amp;gt;&lt;br /&gt;
B-0 B-1 B-2 B-3 B-4 B-5 B-6 B-7 B-8 &amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
At compile time the loop unrolls itself and produces the following lines of code:&lt;br /&gt;
&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
More Examples can be found at [http://en.wikibooks.org/wiki/C++_Programming/Template/Template_Meta-Programming C++ Template Programming], [http://en.wikipedia.org/wiki/Template_metaprogramming Template Metaprogramming] and [http://www.codeproject.com/KB/cpp/crc_meta.aspx TMP in c++]&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete [http://homepage.mac.com/sigfpe/Computing/peano.html]. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Metaprogramming is thus an essential and useful programming feature that allows elimination of duplicated code and enables clean execution with lesser lines of code. The style of metaprogramming differs when it comes to different languages. Ruby and Lisp have more specialized metaprogramming constructs as compared to Java or C++. Metaprogramming is apparently is a higher-level concept and probably used often by expert programmers, nevertheless through metaprogramming the overall code or program becomes very easy to interpret. Its a trade-off that should be balanced by software programmers.&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
* Early Binding: In programming languages, name binding is the association of values with identifiers. The binding of names before the program is run is called early (also &amp;quot;static&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
== References/External Links ==&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Metaprogramming Wikipedia article on metaprogramming]&lt;br /&gt;
# [http://c2.com/cgi/wiki?MetaProgramming Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx Template programming in C++]&lt;br /&gt;
# [http://homepage.mac.com/sigfpe/Computing/peano.html Turing completeness in C++]&lt;br /&gt;
# [http://www.vanderburg.org/Speaking/Stuff/oscon05.pdf presentation about Meta programming in Ruby made at the 2005 O’Reilly Open Source Convention by Glenn Vanderburg] &lt;br /&gt;
# [http://theplana.wordpress.com/2007/03/12/how-to-define-a-attribute-using-metaprogramming/ Defining attributes with Metaprogramming]&lt;br /&gt;
# More examples on Ruby metaprogramming&lt;br /&gt;
## [http://ozone.wordpress.com/2006/03/02/binary-search-tree-sauce-ruby-part-1/ Link 1]&lt;br /&gt;
## [http://www.ruby-doc.org/core/classes/Object.src/M000366.html Link 2]&lt;br /&gt;
## [http://expressica.com/category/metaprogramming/ Link 3]&lt;br /&gt;
# [http://ozone.wordpress.com/2006/02/22/rubybeans-a-short-example-of-ruby-metaprogramming/#comment-1286 Rubybeans and Metaprogramming]&lt;br /&gt;
# [http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-metaprogramming.html Metaprogramming in Ruby]&lt;br /&gt;
# [http://en.wikibooks.org/wiki/C++_Programming/Template/Template_Meta-Programming C++ Template Programming]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Template_metaprogramming Template Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx TMP in c++]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23177</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23177"/>
		<updated>2009-10-08T22:09:19Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Metaprogramming in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Metaprogramming =&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter.&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.'' Source: [http://en.wikipedia.org/wiki/Metaprogramming]&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
Source: [http://c2.com/cgi/wiki?MetaProgramming]&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
==== What makes Ruby good for metaprogramming ====&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*An easy syntax&lt;br /&gt;
&lt;br /&gt;
==== Classification of metaprogramming features in Ruby ====&lt;br /&gt;
* The dynamic nature of Ruby supports creating classes and methods at runtime&lt;br /&gt;
* Methods can be defined directly on Singleton classes: class_eval can be used to define methods on singleton classes. This will then modify the behaviour of the sub classes(if any) and not the base class.&lt;br /&gt;
* Blocks and proc objects: Materializing a Proc and saving this in variables and sending it around is a good way to use metaprogramming to do interesting things. Lambda function is used to define proc objects &lt;br /&gt;
* The different evals: There are 4 different evals in Ruby &lt;br /&gt;
** eval: This call can take a string or binding to evaluate but not a block&lt;br /&gt;
** class_eval: It is just a alias for module_eval&lt;br /&gt;
** instance_eval: It will evaluate the string or the block in the context of the receiver. Thus it sets self to be the receiver.&lt;br /&gt;
** module_eval: It will evaluate the string or the block in the context of the module it is called on. Thus it is used to define new methods on singleton classes. This is the most commonly used eval call.&lt;br /&gt;
&lt;br /&gt;
The difference between the above 4 evals can be understood with examples [http://www.elctech.com/snippets/the-difference-between-eval-class_eval-module_eval-and-instance_eval here]. Another useful external link on evals can be found [http://4loc.wordpress.com/2009/05/29/eval-module_eval-and-instance_eval/ here]&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
We begin by showing how methods can be defined dynamically in Ruby. Consider we need a method that duplicates strings eg. &amp;quot;foo&amp;quot;.duplicate -&amp;gt; &amp;quot;foofoo&amp;quot;. And a deduplicate method for removing duplication eg. &amp;quot;foofoo&amp;quot;.deduplicate -&amp;gt; &amp;quot;foo&amp;quot;. We can define such methods dynamically in Ruby. This ''dynamic'' feature in Ruby forms the simplest kind of metapgrogramming. &lt;br /&gt;
&lt;br /&gt;
 class String&lt;br /&gt;
  def duplicate&lt;br /&gt;
   self * 2&lt;br /&gt;
  end&lt;br /&gt;
  def deduplicate&lt;br /&gt;
   self[0, self.length/2]&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. ''These methods are written in C''. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#Appendix Appendix]. Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Consider how define_method can be used dynamically in Ruby&lt;br /&gt;
 Eagle=Class.new&lt;br /&gt;
 e=Eagle.new&lt;br /&gt;
 class Eagle&lt;br /&gt;
  define_method:fly do&lt;br /&gt;
   puts &amp;quot;I am flying&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 e.fly&lt;br /&gt;
 Output: ''I am flying''&lt;br /&gt;
&lt;br /&gt;
Rails becomes an all-powerful MVC framework, thanks to the metaprogramming features in Ruby.&lt;br /&gt;
&lt;br /&gt;
''Other elaborate examples can be found in the [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#References References] section of this wiki page. A detailed discussion on Metaprogramming in Ruby was done in the CSC517 course lecture, the notes for which can be found [http://courses.ncsu.edu/csc517/common/lectures/notes/lec12-f09.pdf here]''&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of [http://en.wikipedia.org/wiki/Name_binding early binding].  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
'''Calculating a value at compile time''' &amp;lt;br&amp;gt;&lt;br /&gt;
The code to find summation of a number without using templates can be given as:  &amp;lt;br&amp;gt;&lt;br /&gt;
 int summation(int n) &lt;br /&gt;
 {&lt;br /&gt;
     if (n == 0 )&lt;br /&gt;
        return 0;&lt;br /&gt;
     return n + summation(n - 1);&lt;br /&gt;
 }&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
     int b = summation(0);  //b=0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&lt;br /&gt;
 template &amp;lt;int N&amp;gt;&lt;br /&gt;
 //TEMPLATE DEFINITION&lt;br /&gt;
 struct Summation&lt;br /&gt;
 {&lt;br /&gt;
     enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
 };&lt;br /&gt;
 template &amp;lt;&amp;gt;&lt;br /&gt;
 struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
 {&lt;br /&gt;
     enum { value = 0 };&lt;br /&gt;
 };&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
     int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
'''Loop unrolling''' &amp;lt;br&amp;gt; &lt;br /&gt;
Further templates can be used to unroll loops, that is a loop is replaced by repeating the code within the loop a certain number of times. [http://www.codeproject.com/KB/cpp/crc_meta.aspx more on this example]&lt;br /&gt;
&lt;br /&gt;
 template&amp;lt; int i &amp;gt;&lt;br /&gt;
 class LOOP{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
             LOOP&amp;lt; i-1 &amp;gt;::EXEC();&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class LOOP&amp;lt; 0 &amp;gt;{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
The output of LOOP&amp;lt; 8 &amp;gt;::EXEC() is shown below: &amp;lt;br&amp;gt;&lt;br /&gt;
A-8 A-7 A-6 A-5 A-4 A-3 A-2 A-1 A-0 &amp;lt;br&amp;gt;&lt;br /&gt;
B-0 B-1 B-2 B-3 B-4 B-5 B-6 B-7 B-8 &amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
At compile time the loop unrolls itself and produces the following lines of code:&lt;br /&gt;
&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
More Examples can be found at [http://en.wikibooks.org/wiki/C++_Programming/Template/Template_Meta-Programming C++ Template Programming], [http://en.wikipedia.org/wiki/Template_metaprogramming Template Metaprogramming] and [http://www.codeproject.com/KB/cpp/crc_meta.aspx TMP in c++]&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete [http://homepage.mac.com/sigfpe/Computing/peano.html]. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Metaprogramming is thus an essential and useful programming feature that allows elimination of duplicated code and enables clean execution with lesser lines of code. The style of metaprogramming differs when it comes to different languages. Ruby and Lisp have more specialized metaprogramming constructs as compared to Java or C++. Metaprogramming is apparently is a higher-level concept and probably used often by expert programmers, nevertheless through metaprogramming the overall code or program becomes very easy to interpret. Its a trade-off that should be balanced by software programmers.&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References/External Links ==&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Metaprogramming Wikipedia article on metaprogramming]&lt;br /&gt;
# [http://c2.com/cgi/wiki?MetaProgramming Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx Template programming in C++]&lt;br /&gt;
# [http://homepage.mac.com/sigfpe/Computing/peano.html Turing completeness in C++]&lt;br /&gt;
# [http://www.vanderburg.org/Speaking/Stuff/oscon05.pdf presentation about Meta programming in Ruby made at the 2005 O’Reilly Open Source Convention by Glenn Vanderburg] &lt;br /&gt;
# [http://theplana.wordpress.com/2007/03/12/how-to-define-a-attribute-using-metaprogramming/ Defining attributes with Metaprogramming]&lt;br /&gt;
# More examples on Ruby metaprogramming&lt;br /&gt;
## [http://ozone.wordpress.com/2006/03/02/binary-search-tree-sauce-ruby-part-1/ Link 1]&lt;br /&gt;
## [http://www.ruby-doc.org/core/classes/Object.src/M000366.html Link 2]&lt;br /&gt;
## [http://expressica.com/category/metaprogramming/ Link 3]&lt;br /&gt;
# [http://ozone.wordpress.com/2006/02/22/rubybeans-a-short-example-of-ruby-metaprogramming/#comment-1286 Rubybeans and Metaprogramming]&lt;br /&gt;
# [http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-metaprogramming.html Metaprogramming in Ruby]&lt;br /&gt;
# [http://en.wikibooks.org/wiki/C++_Programming/Template/Template_Meta-Programming C++ Template Programming]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Template_metaprogramming Template Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx TMP in c++]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23175</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23175"/>
		<updated>2009-10-08T22:04:07Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* References/External Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Metaprogramming =&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter.&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.'' Source: [http://en.wikipedia.org/wiki/Metaprogramming]&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
Source: [http://c2.com/cgi/wiki?MetaProgramming]&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
==== What makes Ruby good for metaprogramming ====&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*An easy syntax&lt;br /&gt;
&lt;br /&gt;
==== Classification of metaprogramming features in Ruby ====&lt;br /&gt;
* The dynamic nature of Ruby supports creating classes and methods at runtime&lt;br /&gt;
* Methods can be defined directly on Singleton classes: class_eval can be used to define methods on singleton classes. This will then modify the behaviour of the sub classes(if any) and not the base class.&lt;br /&gt;
* Blocks and proc objects: Materializing a Proc and saving this in variables and sending it around is a good way to use metaprogramming to do interesting things. Lambda function is used to define proc objects &lt;br /&gt;
* The different evals: There are 4 different evals in Ruby &lt;br /&gt;
** eval: This call can take a string or binding to evaluate but not a block&lt;br /&gt;
** class_eval: It is just a alias for module_eval&lt;br /&gt;
** instance_eval: It will evaluate the string or the block in the context of the receiver. Thus it sets self to be the receiver.&lt;br /&gt;
** module_eval: It will evaluate the string or the block in the context of the module it is called on. Thus it is used to define new methods on singleton classes. This is the most commonly used eval call.&lt;br /&gt;
&lt;br /&gt;
The difference between the above 4 evals can be understood with examples [http://www.elctech.com/snippets/the-difference-between-eval-class_eval-module_eval-and-instance_eval here]. Another useful external link on evals can be found [http://4loc.wordpress.com/2009/05/29/eval-module_eval-and-instance_eval/ here]&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
We begin by showing how methods can be defined dynamically in Ruby. Consider we need a method that duplicates strings eg. &amp;quot;foo&amp;quot;.duplicate -&amp;gt; &amp;quot;foofoo&amp;quot;. And a deduplicate method for removing duplication eg. &amp;quot;foofoo&amp;quot;.deduplicate -&amp;gt; &amp;quot;foo&amp;quot;. We can define such methods dynamically in Ruby. This ''dynamic'' feature in Ruby forms the simplest kind of metapgrogramming. &lt;br /&gt;
&lt;br /&gt;
 class String&lt;br /&gt;
  def duplicate&lt;br /&gt;
   self * 2&lt;br /&gt;
  end&lt;br /&gt;
  def deduplicate&lt;br /&gt;
   self[0, self.length/2]&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. ''These methods are written in C''. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#Appendix Appendix]. Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Consider how define_method can be used dynamically in Ruby&lt;br /&gt;
 Eagle=Class.new&lt;br /&gt;
 e=Eagle.new&lt;br /&gt;
 class Eagle&lt;br /&gt;
  define_method:fly do&lt;br /&gt;
   puts &amp;quot;I am flying&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 e.fly&lt;br /&gt;
 Output: ''I am flying''&lt;br /&gt;
&lt;br /&gt;
Rails becomes an all-powerful MVC framework, thanks to the metaprogramming features in Ruby.&lt;br /&gt;
&lt;br /&gt;
''Other elaborate examples can be found in the [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#References References] section of this wiki page. A detailed discussion on Metaprogramming in Ruby was done in the CSC517 course lecture, the notes for which can be found [http://courses.ncsu.edu/csc517/common/lectures/notes/lec12-f09.pdf here]''&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of early binding .  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
'''Calculating a value at compile time''' &amp;lt;br&amp;gt;&lt;br /&gt;
The code to find summation of a number without using templates can be given as:  &amp;lt;br&amp;gt;&lt;br /&gt;
 int summation(int n) &lt;br /&gt;
 {&lt;br /&gt;
     if (n == 0 )&lt;br /&gt;
        return 0;&lt;br /&gt;
     return n + summation(n - 1);&lt;br /&gt;
 }&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
     int b = summation(0);  //b=0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&lt;br /&gt;
 template &amp;lt;int N&amp;gt;&lt;br /&gt;
 //TEMPLATE DEFINITION&lt;br /&gt;
 struct Summation&lt;br /&gt;
 {&lt;br /&gt;
     enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
 };&lt;br /&gt;
 template &amp;lt;&amp;gt;&lt;br /&gt;
 struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
 {&lt;br /&gt;
     enum { value = 0 };&lt;br /&gt;
 };&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
     int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
'''Loop unrolling''' &amp;lt;br&amp;gt; &lt;br /&gt;
Further templates can be used to unroll loops, that is a loop is replaced by repeating the code within the loop a certain number of times. [http://www.codeproject.com/KB/cpp/crc_meta.aspx more on this example]&lt;br /&gt;
&lt;br /&gt;
 template&amp;lt; int i &amp;gt;&lt;br /&gt;
 class LOOP{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
             LOOP&amp;lt; i-1 &amp;gt;::EXEC();&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class LOOP&amp;lt; 0 &amp;gt;{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
The output of LOOP&amp;lt; 8 &amp;gt;::EXEC() is shown below: &amp;lt;br&amp;gt;&lt;br /&gt;
A-8 A-7 A-6 A-5 A-4 A-3 A-2 A-1 A-0 &amp;lt;br&amp;gt;&lt;br /&gt;
B-0 B-1 B-2 B-3 B-4 B-5 B-6 B-7 B-8 &amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
At compile time the loop unrolls itself and produces the following lines of code:&lt;br /&gt;
&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
More Examples can be found at [http://en.wikibooks.org/wiki/C++_Programming/Template/Template_Meta-Programming C++ Template Programming], [http://en.wikipedia.org/wiki/Template_metaprogramming Template Metaprogramming] and [http://www.codeproject.com/KB/cpp/crc_meta.aspx TMP in c++]&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete [http://homepage.mac.com/sigfpe/Computing/peano.html]. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Metaprogramming is thus an essential and useful programming feature that allows elimination of duplicated code and enables clean execution with lesser lines of code. The style of metaprogramming differs when it comes to different languages. Ruby and Lisp have more specialized metaprogramming constructs as compared to Java or C++. Metaprogramming is apparently is a higher-level concept and probably used often by expert programmers, nevertheless through metaprogramming the overall code or program becomes very easy to interpret. Its a trade-off that should be balanced by software programmers.&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References/External Links ==&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Metaprogramming Wikipedia article on metaprogramming]&lt;br /&gt;
# [http://c2.com/cgi/wiki?MetaProgramming Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx Template programming in C++]&lt;br /&gt;
# [http://homepage.mac.com/sigfpe/Computing/peano.html Turing completeness in C++]&lt;br /&gt;
# [http://www.vanderburg.org/Speaking/Stuff/oscon05.pdf presentation about Meta programming in Ruby made at the 2005 O’Reilly Open Source Convention by Glenn Vanderburg] &lt;br /&gt;
# [http://theplana.wordpress.com/2007/03/12/how-to-define-a-attribute-using-metaprogramming/ Defining attributes with Metaprogramming]&lt;br /&gt;
# More examples on Ruby metaprogramming&lt;br /&gt;
## [http://ozone.wordpress.com/2006/03/02/binary-search-tree-sauce-ruby-part-1/ Link 1]&lt;br /&gt;
## [http://www.ruby-doc.org/core/classes/Object.src/M000366.html Link 2]&lt;br /&gt;
## [http://expressica.com/category/metaprogramming/ Link 3]&lt;br /&gt;
# [http://ozone.wordpress.com/2006/02/22/rubybeans-a-short-example-of-ruby-metaprogramming/#comment-1286 Rubybeans and Metaprogramming]&lt;br /&gt;
# [http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-metaprogramming.html Metaprogramming in Ruby]&lt;br /&gt;
# [http://en.wikibooks.org/wiki/C++_Programming/Template/Template_Meta-Programming C++ Template Programming]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Template_metaprogramming Template Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx TMP in c++]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23170</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23170"/>
		<updated>2009-10-08T22:02:09Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Metaprogramming =&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter.&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.'' Source: [http://en.wikipedia.org/wiki/Metaprogramming]&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
Source: [http://c2.com/cgi/wiki?MetaProgramming]&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
==== What makes Ruby good for metaprogramming ====&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*An easy syntax&lt;br /&gt;
&lt;br /&gt;
==== Classification of metaprogramming features in Ruby ====&lt;br /&gt;
* The dynamic nature of Ruby supports creating classes and methods at runtime&lt;br /&gt;
* Methods can be defined directly on Singleton classes: class_eval can be used to define methods on singleton classes. This will then modify the behaviour of the sub classes(if any) and not the base class.&lt;br /&gt;
* Blocks and proc objects: Materializing a Proc and saving this in variables and sending it around is a good way to use metaprogramming to do interesting things. Lambda function is used to define proc objects &lt;br /&gt;
* The different evals: There are 4 different evals in Ruby &lt;br /&gt;
** eval: This call can take a string or binding to evaluate but not a block&lt;br /&gt;
** class_eval: It is just a alias for module_eval&lt;br /&gt;
** instance_eval: It will evaluate the string or the block in the context of the receiver. Thus it sets self to be the receiver.&lt;br /&gt;
** module_eval: It will evaluate the string or the block in the context of the module it is called on. Thus it is used to define new methods on singleton classes. This is the most commonly used eval call.&lt;br /&gt;
&lt;br /&gt;
The difference between the above 4 evals can be understood with examples [http://www.elctech.com/snippets/the-difference-between-eval-class_eval-module_eval-and-instance_eval here]. Another useful external link on evals can be found [http://4loc.wordpress.com/2009/05/29/eval-module_eval-and-instance_eval/ here]&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
We begin by showing how methods can be defined dynamically in Ruby. Consider we need a method that duplicates strings eg. &amp;quot;foo&amp;quot;.duplicate -&amp;gt; &amp;quot;foofoo&amp;quot;. And a deduplicate method for removing duplication eg. &amp;quot;foofoo&amp;quot;.deduplicate -&amp;gt; &amp;quot;foo&amp;quot;. We can define such methods dynamically in Ruby. This ''dynamic'' feature in Ruby forms the simplest kind of metapgrogramming. &lt;br /&gt;
&lt;br /&gt;
 class String&lt;br /&gt;
  def duplicate&lt;br /&gt;
   self * 2&lt;br /&gt;
  end&lt;br /&gt;
  def deduplicate&lt;br /&gt;
   self[0, self.length/2]&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. ''These methods are written in C''. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#Appendix Appendix]. Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Consider how define_method can be used dynamically in Ruby&lt;br /&gt;
 Eagle=Class.new&lt;br /&gt;
 e=Eagle.new&lt;br /&gt;
 class Eagle&lt;br /&gt;
  define_method:fly do&lt;br /&gt;
   puts &amp;quot;I am flying&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 e.fly&lt;br /&gt;
 Output: ''I am flying''&lt;br /&gt;
&lt;br /&gt;
Rails becomes an all-powerful MVC framework, thanks to the metaprogramming features in Ruby.&lt;br /&gt;
&lt;br /&gt;
''Other elaborate examples can be found in the [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#References References] section of this wiki page. A detailed discussion on Metaprogramming in Ruby was done in the CSC517 course lecture, the notes for which can be found [http://courses.ncsu.edu/csc517/common/lectures/notes/lec12-f09.pdf here]''&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of early binding .  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
'''Calculating a value at compile time''' &amp;lt;br&amp;gt;&lt;br /&gt;
The code to find summation of a number without using templates can be given as:  &amp;lt;br&amp;gt;&lt;br /&gt;
 int summation(int n) &lt;br /&gt;
 {&lt;br /&gt;
     if (n == 0 )&lt;br /&gt;
        return 0;&lt;br /&gt;
     return n + summation(n - 1);&lt;br /&gt;
 }&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
     int b = summation(0);  //b=0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&lt;br /&gt;
 template &amp;lt;int N&amp;gt;&lt;br /&gt;
 //TEMPLATE DEFINITION&lt;br /&gt;
 struct Summation&lt;br /&gt;
 {&lt;br /&gt;
     enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
 };&lt;br /&gt;
 template &amp;lt;&amp;gt;&lt;br /&gt;
 struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
 {&lt;br /&gt;
     enum { value = 0 };&lt;br /&gt;
 };&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
     int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
'''Loop unrolling''' &amp;lt;br&amp;gt; &lt;br /&gt;
Further templates can be used to unroll loops, that is a loop is replaced by repeating the code within the loop a certain number of times. [http://www.codeproject.com/KB/cpp/crc_meta.aspx more on this example]&lt;br /&gt;
&lt;br /&gt;
 template&amp;lt; int i &amp;gt;&lt;br /&gt;
 class LOOP{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
             LOOP&amp;lt; i-1 &amp;gt;::EXEC();&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class LOOP&amp;lt; 0 &amp;gt;{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
The output of LOOP&amp;lt; 8 &amp;gt;::EXEC() is shown below: &amp;lt;br&amp;gt;&lt;br /&gt;
A-8 A-7 A-6 A-5 A-4 A-3 A-2 A-1 A-0 &amp;lt;br&amp;gt;&lt;br /&gt;
B-0 B-1 B-2 B-3 B-4 B-5 B-6 B-7 B-8 &amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
At compile time the loop unrolls itself and produces the following lines of code:&lt;br /&gt;
&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
More Examples can be found at [http://en.wikibooks.org/wiki/C++_Programming/Template/Template_Meta-Programming C++ Template Programming], [http://en.wikipedia.org/wiki/Template_metaprogramming Template Metaprogramming] and [http://www.codeproject.com/KB/cpp/crc_meta.aspx TMP in c++]&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete [http://homepage.mac.com/sigfpe/Computing/peano.html]. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Metaprogramming is thus an essential and useful programming feature that allows elimination of duplicated code and enables clean execution with lesser lines of code. The style of metaprogramming differs when it comes to different languages. Ruby and Lisp have more specialized metaprogramming constructs as compared to Java or C++. Metaprogramming is apparently is a higher-level concept and probably used often by expert programmers, nevertheless through metaprogramming the overall code or program becomes very easy to interpret. Its a trade-off that should be balanced by software programmers.&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References/External Links ==&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Metaprogramming Wikipedia article on metaprogramming]&lt;br /&gt;
# [http://c2.com/cgi/wiki?MetaProgramming Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx Template programming in C++]&lt;br /&gt;
# [http://homepage.mac.com/sigfpe/Computing/peano.html Turing completeness in C++]&lt;br /&gt;
# [http://www.vanderburg.org/Speaking/Stuff/oscon05.pdf presentation about Meta programming in Ruby made at the 2005 O’Reilly Open Source Convention by Glenn Vanderburg] &lt;br /&gt;
# [http://theplana.wordpress.com/2007/03/12/how-to-define-a-attribute-using-metaprogramming/ Defining attributes with Metaprogramming]&lt;br /&gt;
# More examples on Ruby metaprogramming&lt;br /&gt;
## [http://ozone.wordpress.com/2006/03/02/binary-search-tree-sauce-ruby-part-1/ Link 1]&lt;br /&gt;
## [http://www.ruby-doc.org/core/classes/Object.src/M000366.html Link 2]&lt;br /&gt;
## [http://expressica.com/category/metaprogramming/ Link 3]&lt;br /&gt;
# [http://ozone.wordpress.com/2006/02/22/rubybeans-a-short-example-of-ruby-metaprogramming/#comment-1286 Rubybeans and Metaprogramming]&lt;br /&gt;
# [http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-metaprogramming.html Metaprogramming in Ruby]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23166</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23166"/>
		<updated>2009-10-08T21:56:08Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Metaprogramming =&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter.&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.'' Source: [http://en.wikipedia.org/wiki/Metaprogramming]&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
Source: [http://c2.com/cgi/wiki?MetaProgramming]&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
==== What makes Ruby good for metaprogramming ====&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*An easy syntax&lt;br /&gt;
&lt;br /&gt;
==== Classification of metaprogramming features in Ruby ====&lt;br /&gt;
* The dynamic nature of Ruby supports creating classes and methods at runtime&lt;br /&gt;
* Methods can be defined directly on Singleton classes: class_eval can be used to define methods on singleton classes. This will then modify the behaviour of the sub classes(if any) and not the base class.&lt;br /&gt;
* Blocks and proc objects: Materializing a Proc and saving this in variables and sending it around is a good way to use metaprogramming to do interesting things. Lambda function is used to define proc objects &lt;br /&gt;
* The different evals: There are 4 different evals in Ruby &lt;br /&gt;
** eval: This call can take a string or binding to evaluate but not a block&lt;br /&gt;
** class_eval: It is just a alias for module_eval&lt;br /&gt;
** instance_eval: It will evaluate the string or the block in the context of the receiver. Thus it sets self to be the receiver.&lt;br /&gt;
** module_eval: It will evaluate the string or the block in the context of the module it is called on. Thus it is used to define new methods on singleton classes. This is the most commonly used eval call.&lt;br /&gt;
&lt;br /&gt;
The difference between the above 4 evals can be understood with examples [http://www.elctech.com/snippets/the-difference-between-eval-class_eval-module_eval-and-instance_eval here]. Another useful external link on evals can be found [http://4loc.wordpress.com/2009/05/29/eval-module_eval-and-instance_eval/ here]&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
We begin by showing how methods can be defined dynamically in Ruby. Consider we need a method that duplicates strings eg. &amp;quot;foo&amp;quot;.duplicate -&amp;gt; &amp;quot;foofoo&amp;quot;. And a deduplicate method for removing duplication eg. &amp;quot;foofoo&amp;quot;.deduplicate -&amp;gt; &amp;quot;foo&amp;quot;. We can define such methods dynamically in Ruby. This ''dynamic'' feature in Ruby forms the simplest kind of metapgrogramming. &lt;br /&gt;
&lt;br /&gt;
 class String&lt;br /&gt;
  def duplicate&lt;br /&gt;
   self * 2&lt;br /&gt;
  end&lt;br /&gt;
  def deduplicate&lt;br /&gt;
   self[0, self.length/2]&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. ''These methods are written in C''. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#Appendix Appendix]. Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Consider how define_method can be used dynamically in Ruby&lt;br /&gt;
 Eagle=Class.new&lt;br /&gt;
 e=Eagle.new&lt;br /&gt;
 class Eagle&lt;br /&gt;
  define_method:fly do&lt;br /&gt;
   puts &amp;quot;I am flying&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 e.fly&lt;br /&gt;
 Output: ''I am flying''&lt;br /&gt;
&lt;br /&gt;
Rails becomes an all-powerful MVC framework, thanks to the metaprogramming features in Ruby.&lt;br /&gt;
&lt;br /&gt;
''Other elaborate examples can be found in the [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#References References] section of this wiki page. A detailed discussion on Metaprogramming in Ruby was done in the CSC517 course lecture, the notes for which can be found [http://courses.ncsu.edu/csc517/common/lectures/notes/lec12-f09.pdf here]''&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of early binding .  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
'''Calculating a value at compile time''' &amp;lt;br&amp;gt;&lt;br /&gt;
The code to find summation of a number without using templates can be given as:  &amp;lt;br&amp;gt;&lt;br /&gt;
 int summation(int n) &lt;br /&gt;
 {&lt;br /&gt;
     if (n == 0 )&lt;br /&gt;
        return 0;&lt;br /&gt;
     return n + summation(n - 1);&lt;br /&gt;
 }&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
     int b = summation(0);  //b=0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&lt;br /&gt;
 template &amp;lt;int N&amp;gt;&lt;br /&gt;
 //TEMPLATE DEFINITION&lt;br /&gt;
 struct Summation&lt;br /&gt;
 {&lt;br /&gt;
     enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
 };&lt;br /&gt;
 template &amp;lt;&amp;gt;&lt;br /&gt;
 struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
 {&lt;br /&gt;
     enum { value = 0 };&lt;br /&gt;
 };&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
     int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
'''Loop unrolling''' &amp;lt;br&amp;gt; &lt;br /&gt;
Further templates can be used to unroll loops, that is a loop is replaced by repeating the code within the loop a certain number of times. [http://www.codeproject.com/KB/cpp/crc_meta.aspx more on this example]&lt;br /&gt;
&lt;br /&gt;
 template&amp;lt; int i &amp;gt;&lt;br /&gt;
 class LOOP{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
             LOOP&amp;lt; i-1 &amp;gt;::EXEC();&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class LOOP&amp;lt; 0 &amp;gt;{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
The output of LOOP&amp;lt; 8 &amp;gt;::EXEC() is shown below: &amp;lt;br&amp;gt;&lt;br /&gt;
A-8 A-7 A-6 A-5 A-4 A-3 A-2 A-1 A-0 &amp;lt;br&amp;gt;&lt;br /&gt;
B-0 B-1 B-2 B-3 B-4 B-5 B-6 B-7 B-8 &amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
At compile time the loop unrolls itself and produces the following lines of code:&lt;br /&gt;
&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete [http://homepage.mac.com/sigfpe/Computing/peano.html]. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Metaprogramming is thus an essential and useful programming feature that allows elimination of duplicated code and enables clean execution with lesser lines of code. The style of metaprogramming differs when it comes to different languages. Ruby and Lisp have more specialized metaprogramming constructs as compared to Java or C++. Metaprogramming is apparently is a higher-level concept and probably used often by expert programmers, nevertheless through metaprogramming the overall code or program becomes very easy to interpret. Its a trade-off that should be balanced by software programmers.&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References/External Links ==&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Metaprogramming Wikipedia article on metaprogramming]&lt;br /&gt;
# [http://c2.com/cgi/wiki?MetaProgramming Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx Template programming in C++]&lt;br /&gt;
# [http://homepage.mac.com/sigfpe/Computing/peano.html Turing completeness in C++]&lt;br /&gt;
# [http://www.vanderburg.org/Speaking/Stuff/oscon05.pdf presentation about Meta programming in Ruby made at the 2005 O’Reilly Open Source Convention by Glenn Vanderburg] &lt;br /&gt;
# [http://theplana.wordpress.com/2007/03/12/how-to-define-a-attribute-using-metaprogramming/ Defining attributes with Metaprogramming]&lt;br /&gt;
# More examples on Ruby metaprogramming&lt;br /&gt;
## [http://ozone.wordpress.com/2006/03/02/binary-search-tree-sauce-ruby-part-1/ Link 1]&lt;br /&gt;
## [http://www.ruby-doc.org/core/classes/Object.src/M000366.html Link 2]&lt;br /&gt;
## [http://expressica.com/category/metaprogramming/ Link 3]&lt;br /&gt;
# [http://ozone.wordpress.com/2006/02/22/rubybeans-a-short-example-of-ruby-metaprogramming/#comment-1286 Rubybeans and Metaprogramming]&lt;br /&gt;
# [http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-metaprogramming.html Metaprogramming in Ruby]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23165</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23165"/>
		<updated>2009-10-08T21:53:33Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Metaprogramming =&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter.&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.'' Source: [http://en.wikipedia.org/wiki/Metaprogramming]&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
Source: [http://c2.com/cgi/wiki?MetaProgramming]&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
==== What makes Ruby good for metaprogramming ====&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*An easy syntax&lt;br /&gt;
&lt;br /&gt;
==== Classification of metaprogramming features in Ruby ====&lt;br /&gt;
* The dynamic nature of Ruby supports creating classes and methods at runtime&lt;br /&gt;
* Methods can be defined directly on Singleton classes: class_eval can be used to define methods on singleton classes. This will then modify the behaviour of the sub classes(if any) and not the base class.&lt;br /&gt;
* Blocks and proc objects: Materializing a Proc and saving this in variables and sending it around is a good way to use metaprogramming to do interesting things. Lambda function is used to define proc objects &lt;br /&gt;
* The different evals: There are 4 different evals in Ruby &lt;br /&gt;
** eval: This call can take a string or binding to evaluate but not a block&lt;br /&gt;
** class_eval: It is just a alias for module_eval&lt;br /&gt;
** instance_eval: It will evaluate the string or the block in the context of the receiver. Thus it sets self to be the receiver.&lt;br /&gt;
** module_eval: It will evaluate the string or the block in the context of the module it is called on. Thus it is used to define new methods on singleton classes. This is the most commonly used eval call.&lt;br /&gt;
&lt;br /&gt;
The difference between the above 4 evals can be understood with examples [http://www.elctech.com/snippets/the-difference-between-eval-class_eval-module_eval-and-instance_eval here]. Another useful external link on evals can be found [http://4loc.wordpress.com/2009/05/29/eval-module_eval-and-instance_eval/ here]&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
We begin by showing how methods can be defined dynamically in Ruby. Consider we need a method that duplicates strings eg. &amp;quot;foo&amp;quot;.duplicate -&amp;gt; &amp;quot;foofoo&amp;quot;. And a deduplicate method for removing duplication eg. &amp;quot;foofoo&amp;quot;.deduplicate -&amp;gt; &amp;quot;foo&amp;quot;. We can define such methods dynamically in Ruby. This ''dynamic'' feature in Ruby forms the simplest kind of metapgrogramming. &lt;br /&gt;
&lt;br /&gt;
 class String&lt;br /&gt;
  def duplicate&lt;br /&gt;
   self * 2&lt;br /&gt;
  end&lt;br /&gt;
  def deduplicate&lt;br /&gt;
   self[0, self.length/2]&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. ''These methods are written in C''. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#Appendix Appendix]. Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Consider how define_method can be used dynamically in Ruby&lt;br /&gt;
 Eagle=Class.new&lt;br /&gt;
 e=Eagle.new&lt;br /&gt;
 class Eagle&lt;br /&gt;
  define_method:fly do&lt;br /&gt;
   puts &amp;quot;I am flying&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 e.fly&lt;br /&gt;
 Output: ''I am flying''&lt;br /&gt;
&lt;br /&gt;
Rails becomes an all-powerful MVC framework, thanks to the metaprogramming features in Ruby.&lt;br /&gt;
&lt;br /&gt;
''Other elaborate examples can be found in the [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#References References] section of this wiki page. A detailed discussion on Metaprogramming in Ruby was done in the CSC517 course lecture, the notes for which can be found [http://courses.ncsu.edu/csc517/common/lectures/notes/lec12-f09.pdf here]''&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of early binding .  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
'''Calculating a value at compile time''' &amp;lt;br&amp;gt;&lt;br /&gt;
The code to find summation of a number without using templates can be given as:  &amp;lt;br&amp;gt;&lt;br /&gt;
 int summation(int n) &lt;br /&gt;
 {&lt;br /&gt;
     if (n == 0 )&lt;br /&gt;
        return 0;&lt;br /&gt;
     return n + summation(n - 1);&lt;br /&gt;
 }&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
     int b = summation(0);  //b=0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&lt;br /&gt;
 template &amp;lt;int N&amp;gt;&lt;br /&gt;
 //TEMPLATE DEFINITION&lt;br /&gt;
 struct Summation&lt;br /&gt;
 {&lt;br /&gt;
     enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
 };&lt;br /&gt;
 template &amp;lt;&amp;gt;&lt;br /&gt;
 struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
 {&lt;br /&gt;
     enum { value = 0 };&lt;br /&gt;
 };&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
     int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
'''Loop unrolling''' &amp;lt;br&amp;gt;&lt;br /&gt;
Further templates can be used to unroll loops, that is a loop is replaced by repeating the code within the loop a certain number of times&lt;br /&gt;
&lt;br /&gt;
 template&amp;lt; int i &amp;gt;&lt;br /&gt;
 class LOOP{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
             LOOP&amp;lt; i-1 &amp;gt;::EXEC();&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class LOOP&amp;lt; 0 &amp;gt;{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
The output of LOOP&amp;lt; 8 &amp;gt;::EXEC() is shown below: &amp;lt;br&amp;gt;&lt;br /&gt;
A-8 A-7 A-6 A-5 A-4 A-3 A-2 A-1 A-0 &amp;lt;br&amp;gt;&lt;br /&gt;
B-0 B-1 B-2 B-3 B-4 B-5 B-6 B-7 B-8 &amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
At compile time the loop unrolls itself and produces the following lines of code:&lt;br /&gt;
&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete [http://homepage.mac.com/sigfpe/Computing/peano.html]. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Metaprogramming is thus an essential and useful programming feature that allows elimination of duplicated code and enables clean execution with lesser lines of code. The style of metaprogramming differs when it comes to different languages. Ruby and Lisp have more specialized metaprogramming constructs as compared to Java or C++. Metaprogramming is apparently is a higher-level concept and probably used often by expert programmers, nevertheless through metaprogramming the overall code or program becomes very easy to interpret. Its a trade-off that should be balanced by software programmers.&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References/External Links ==&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Metaprogramming Wikipedia article on metaprogramming]&lt;br /&gt;
# [http://c2.com/cgi/wiki?MetaProgramming Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx Template programming in C++]&lt;br /&gt;
# [http://homepage.mac.com/sigfpe/Computing/peano.html Turing completeness in C++]&lt;br /&gt;
# [http://www.vanderburg.org/Speaking/Stuff/oscon05.pdf presentation about Meta programming in Ruby made at the 2005 O’Reilly Open Source Convention by Glenn Vanderburg] &lt;br /&gt;
# [http://theplana.wordpress.com/2007/03/12/how-to-define-a-attribute-using-metaprogramming/ Defining attributes with Metaprogramming]&lt;br /&gt;
# More examples on Ruby metaprogramming&lt;br /&gt;
## [http://ozone.wordpress.com/2006/03/02/binary-search-tree-sauce-ruby-part-1/ Link 1]&lt;br /&gt;
## [http://www.ruby-doc.org/core/classes/Object.src/M000366.html Link 2]&lt;br /&gt;
## [http://expressica.com/category/metaprogramming/ Link 3]&lt;br /&gt;
# [http://ozone.wordpress.com/2006/02/22/rubybeans-a-short-example-of-ruby-metaprogramming/#comment-1286 Rubybeans and Metaprogramming]&lt;br /&gt;
# [http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-metaprogramming.html Metaprogramming in Ruby]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23161</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=23161"/>
		<updated>2009-10-08T21:51:43Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Metaprogramming =&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter.&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.'' Source: [http://en.wikipedia.org/wiki/Metaprogramming]&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
Source: [http://c2.com/cgi/wiki?MetaProgramming]&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
==== What makes Ruby good for metaprogramming ====&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*An easy syntax&lt;br /&gt;
&lt;br /&gt;
==== Classification of metaprogramming features in Ruby ====&lt;br /&gt;
* The dynamic nature of Ruby supports creating classes and methods at runtime&lt;br /&gt;
* Methods can be defined directly on Singleton classes: class_eval can be used to define methods on singleton classes. This will then modify the behaviour of the sub classes(if any) and not the base class.&lt;br /&gt;
* Blocks and proc objects: Materializing a Proc and saving this in variables and sending it around is a good way to use metaprogramming to do interesting things. Lambda function is used to define proc objects &lt;br /&gt;
* The different evals: There are 4 different evals in Ruby &lt;br /&gt;
** eval: This call can take a string or binding to evaluate but not a block&lt;br /&gt;
** class_eval: It is just a alias for module_eval&lt;br /&gt;
** instance_eval: It will evaluate the string or the block in the context of the receiver. Thus it sets self to be the receiver.&lt;br /&gt;
** module_eval: It will evaluate the string or the block in the context of the module it is called on. Thus it is used to define new methods on singleton classes. This is the most commonly used eval call.&lt;br /&gt;
&lt;br /&gt;
The difference between the above 4 evals can be understood with examples [http://www.elctech.com/snippets/the-difference-between-eval-class_eval-module_eval-and-instance_eval here]. Another useful external link on evals can be found [http://4loc.wordpress.com/2009/05/29/eval-module_eval-and-instance_eval/ here]&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
We begin by showing how methods can be defined dynamically in Ruby. Consider we need a method that duplicates strings eg. &amp;quot;foo&amp;quot;.duplicate -&amp;gt; &amp;quot;foofoo&amp;quot;. And a deduplicate method for removing duplication eg. &amp;quot;foofoo&amp;quot;.deduplicate -&amp;gt; &amp;quot;foo&amp;quot;. We can define such methods dynamically in Ruby. This ''dynamic'' feature in Ruby forms the simplest kind of metapgrogramming. &lt;br /&gt;
&lt;br /&gt;
 class String&lt;br /&gt;
  def duplicate&lt;br /&gt;
   self * 2&lt;br /&gt;
  end&lt;br /&gt;
  def deduplicate&lt;br /&gt;
   self[0, self.length/2]&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. ''These methods are written in C''. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#Appendix Appendix]. Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Consider how define_method can be used dynamically in Ruby&lt;br /&gt;
 Eagle=Class.new&lt;br /&gt;
 e=Eagle.new&lt;br /&gt;
 class Eagle&lt;br /&gt;
  define_method:fly do&lt;br /&gt;
   puts &amp;quot;I am flying&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
 e.fly&lt;br /&gt;
 Output: ''I am flying''&lt;br /&gt;
&lt;br /&gt;
Rails becomes an all-powerful MVC framework, thanks to the metaprogramming features in Ruby.&lt;br /&gt;
&lt;br /&gt;
''Other elaborate examples can be found in the [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki2_1_ma#References References] section of this wiki page. A detailed discussion on Metaprogramming in Ruby was done in the CSC517 course lecture, the notes for which can be found [http://courses.ncsu.edu/csc517/common/lectures/notes/lec12-f09.pdf here]''&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of early binding .  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
'''Calculating a value at compile time'''&lt;br /&gt;
The code to find summation of a number without using templates can be given as: &lt;br /&gt;
 int summation(int n) &lt;br /&gt;
 {&lt;br /&gt;
     if (n == 0 )&lt;br /&gt;
        return 0;&lt;br /&gt;
     return n + summation(n - 1);&lt;br /&gt;
 }&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
     int b = summation(0);  //b=0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&lt;br /&gt;
 template &amp;lt;int N&amp;gt;&lt;br /&gt;
 //TEMPLATE DEFINITION&lt;br /&gt;
 struct Summation&lt;br /&gt;
 {&lt;br /&gt;
     enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
 };&lt;br /&gt;
 template &amp;lt;&amp;gt;&lt;br /&gt;
 struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
 {&lt;br /&gt;
     enum { value = 0 };&lt;br /&gt;
 };&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
     int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
'''Loop unrolling'''&lt;br /&gt;
Further templates can be used to unroll loops, that is a loop is replaced by repeating the code within the loop a certain number of times&lt;br /&gt;
&lt;br /&gt;
 template&amp;lt; int i &amp;gt;&lt;br /&gt;
 class LOOP{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
             LOOP&amp;lt; i-1 &amp;gt;::EXEC();&lt;br /&gt;
        cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class LOOP&amp;lt; 0 &amp;gt;{&lt;br /&gt;
   public:&lt;br /&gt;
     static inline void EXEC(){&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
     }&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
The output of LOOP&amp;lt; 8 &amp;gt;::EXEC() is shown below: &lt;br /&gt;
A-8 A-7 A-6 A-5 A-4 A-3 A-2 A-1 A-0 &lt;br /&gt;
B-0 B-1 B-2 B-3 B-4 B-5 B-6 B-7 B-8 &lt;br /&gt;
 &lt;br /&gt;
At compile time the loop unrolls itself and produces the following lines of code:&lt;br /&gt;
&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
 ...&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
 cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete [http://homepage.mac.com/sigfpe/Computing/peano.html]. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Metaprogramming is thus an essential and useful programming feature that allows elimination of duplicated code and enables clean execution with lesser lines of code. The style of metaprogramming differs when it comes to different languages. Ruby and Lisp have more specialized metaprogramming constructs as compared to Java or C++. Metaprogramming is apparently is a higher-level concept and probably used often by expert programmers, nevertheless through metaprogramming the overall code or program becomes very easy to interpret. Its a trade-off that should be balanced by software programmers.&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References/External Links ==&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Metaprogramming Wikipedia article on metaprogramming]&lt;br /&gt;
# [http://c2.com/cgi/wiki?MetaProgramming Metaprogramming]&lt;br /&gt;
# [http://www.codeproject.com/KB/cpp/crc_meta.aspx Template programming in C++]&lt;br /&gt;
# [http://homepage.mac.com/sigfpe/Computing/peano.html Turing completeness in C++]&lt;br /&gt;
# [http://www.vanderburg.org/Speaking/Stuff/oscon05.pdf presentation about Meta programming in Ruby made at the 2005 O’Reilly Open Source Convention by Glenn Vanderburg] &lt;br /&gt;
# [http://theplana.wordpress.com/2007/03/12/how-to-define-a-attribute-using-metaprogramming/ Defining attributes with Metaprogramming]&lt;br /&gt;
# More examples on Ruby metaprogramming&lt;br /&gt;
## [http://ozone.wordpress.com/2006/03/02/binary-search-tree-sauce-ruby-part-1/ Link 1]&lt;br /&gt;
## [http://www.ruby-doc.org/core/classes/Object.src/M000366.html Link 2]&lt;br /&gt;
## [http://expressica.com/category/metaprogramming/ Link 3]&lt;br /&gt;
# [http://ozone.wordpress.com/2006/02/22/rubybeans-a-short-example-of-ruby-metaprogramming/#comment-1286 Rubybeans and Metaprogramming]&lt;br /&gt;
# [http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-metaprogramming.html Metaprogramming in Ruby]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22992</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22992"/>
		<updated>2009-10-08T17:24:41Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Metaprogramming in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Metaprogramming is the writing of a program that writes other programs. Metaprogramming is not limited to o-o languages, but it seems that about half of the languages that support metaprogramming are object oriented. Consider how metaprogramming is done in the various languages, and give an example of writing a particular metaprogram in at least two of these languages to illustrate the differences. Since the Wikipedia article on metaprogramming is not very detailed, if you do a good job, you could submit this article to Wikipedia.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter. Source: Wikipedia&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
What makes Ruby good for metaprogramming&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*Only slightly less malleable than Lisp (no macros)&lt;br /&gt;
*A fantastic syntax&lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. These methods are written in C. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer Appendix. &lt;br /&gt;
&lt;br /&gt;
Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of early binding .  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
The code to find summation of a number without using templates can be given as:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 int summation(int n) &lt;br /&gt;
 {&lt;br /&gt;
     if (n == 0 )&lt;br /&gt;
        return 0;&lt;br /&gt;
     return n + summation(n - 1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
     int b = summation(0);  //b=0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&lt;br /&gt;
 template &amp;lt;int N&amp;gt;&lt;br /&gt;
 //TEMPLATE DEFINITION&lt;br /&gt;
 struct Summation&lt;br /&gt;
 {&lt;br /&gt;
     enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
 };&lt;br /&gt;
 template &amp;lt;&amp;gt;&lt;br /&gt;
 struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
 {&lt;br /&gt;
     enum { value = 0 };&lt;br /&gt;
 };&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
     int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
Loop unrolling&lt;br /&gt;
Further templates can be used to unroll loops , that is a loop is replaced by repeating the code within the loop a certain number of times&lt;br /&gt;
Collapse code snippet&lt;br /&gt;
template&amp;lt; int i &amp;gt;&lt;br /&gt;
class LOOP{&lt;br /&gt;
  public:&lt;br /&gt;
    static inline void EXEC(){&lt;br /&gt;
      cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
            LOOP&amp;lt; i-1 &amp;gt;::EXEC();&lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class LOOP&amp;lt; 0 &amp;gt;{&lt;br /&gt;
  public:&lt;br /&gt;
    static inline void EXEC(){&lt;br /&gt;
      cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
      cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
       cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; i;&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
The output of LOOP&amp;lt; 8 &amp;gt;::EXEC() is shown below: &lt;br /&gt;
A-8 A-7 A-6 A-5 A-4 A-3 A-2 A-1 A-0 &lt;br /&gt;
B-0 B-1 B-2 B-3 B-4 B-5 B-6 B-7 B-8 &lt;br /&gt;
At compile time the loop unrolls itself and produces the following lines of code:&lt;br /&gt;
Collapse&lt;br /&gt;
cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
...&lt;br /&gt;
cout &amp;lt;&amp;lt; &amp;quot;A-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
cout &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;; &lt;br /&gt;
cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 0;&lt;br /&gt;
...&lt;br /&gt;
cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 7 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
cout &amp;lt;&amp;lt; &amp;quot;B-&amp;quot; &amp;lt;&amp;lt; 8 &amp;lt;&amp;lt; &amp;quot; &amp;quot;;&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Metaprogramming is thus an essential and useful programming feature that allows elimination of duplicated code and enables clean execution with lesser lines of code. The style of metaprogramming differs when it comes to different languages. Ruby and Lisp have more specialized metaprogramming constructs as compared to Java or C++. Metaprogramming is apparently is a higher-level concept and probably used often by expert programmers, nevertheless through metaprogramming the overall code or program becomes very easy to interpret. Its a trade-off that should be balanced by software programmers.&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22977</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22977"/>
		<updated>2009-10-08T17:09:50Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Metaprogramming is the writing of a program that writes other programs. Metaprogramming is not limited to o-o languages, but it seems that about half of the languages that support metaprogramming are object oriented. Consider how metaprogramming is done in the various languages, and give an example of writing a particular metaprogram in at least two of these languages to illustrate the differences. Since the Wikipedia article on metaprogramming is not very detailed, if you do a good job, you could submit this article to Wikipedia.&lt;br /&gt;
&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter. Source: Wikipedia&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
What makes Ruby good for metaprogramming&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*Only slightly less malleable than Lisp (no macros)&lt;br /&gt;
*A fantastic syntax&lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. These methods are written in C. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer Appendix. &lt;br /&gt;
&lt;br /&gt;
Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of early binding .  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
The code to find summation of a number without using templates can be given as:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 int summation(int n) &lt;br /&gt;
 {&lt;br /&gt;
     if (n == 0 )&lt;br /&gt;
        return 0;&lt;br /&gt;
     return n + summation(n - 1);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
     int b = summation(0);  //b=0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&lt;br /&gt;
 template &amp;lt;int N&amp;gt;&lt;br /&gt;
 //TEMPLATE DEFINITION&lt;br /&gt;
 struct Summation&lt;br /&gt;
 {&lt;br /&gt;
     enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
 };&lt;br /&gt;
 template &amp;lt;&amp;gt;&lt;br /&gt;
 struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
 {&lt;br /&gt;
     enum { value = 0 };&lt;br /&gt;
 };&lt;br /&gt;
 void findsummation()&lt;br /&gt;
 {&lt;br /&gt;
     int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
     int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22976</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22976"/>
		<updated>2009-10-08T17:08:46Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Metaprogramming is the writing of a program that writes other programs. Metaprogramming is not limited to o-o languages, but it seems that about half of the languages that support metaprogramming are object oriented. Consider how metaprogramming is done in the various languages, and give an example of writing a particular metaprogram in at least two of these languages to illustrate the differences. Since the Wikipedia article on metaprogramming is not very detailed, if you do a good job, you could submit this article to Wikipedia.&lt;br /&gt;
&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter. Source: Wikipedia&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
What makes Ruby good for metaprogramming&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*Only slightly less malleable than Lisp (no macros)&lt;br /&gt;
*A fantastic syntax&lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. These methods are written in C. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer Appendix. &lt;br /&gt;
&lt;br /&gt;
Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of early binding .  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
The code to find summation of a number without using templates can be given as:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
int summation(int n) &lt;br /&gt;
{&lt;br /&gt;
    if (n == 0 )&lt;br /&gt;
       return 0;&lt;br /&gt;
    return n + summation(n - 1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void findsummation()&lt;br /&gt;
{&lt;br /&gt;
    int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
    int b = summation(0);  //b=0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
template &amp;lt;int N&amp;gt;&lt;br /&gt;
//TEMPLATE DEFINITION&lt;br /&gt;
struct Summation&lt;br /&gt;
{&lt;br /&gt;
    enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
};&lt;br /&gt;
template &amp;lt;&amp;gt;&lt;br /&gt;
struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
{&lt;br /&gt;
    enum { value = 0 };&lt;br /&gt;
};&lt;br /&gt;
Void findsummation()&lt;br /&gt;
{&lt;br /&gt;
    int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
    int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22975</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22975"/>
		<updated>2009-10-08T17:08:17Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Metaprogramming in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Metaprogramming is the writing of a program that writes other programs. Metaprogramming is not limited to o-o languages, but it seems that about half of the languages that support metaprogramming are object oriented. Consider how metaprogramming is done in the various languages, and give an example of writing a particular metaprogram in at least two of these languages to illustrate the differences. Since the Wikipedia article on metaprogramming is not very detailed, if you do a good job, you could submit this article to Wikipedia.&lt;br /&gt;
&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter. Source: Wikipedia&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Metaprogramming is divided into runtime metaprogramming, also known as reflection, and compile time metaprogramming. Reflection is more interesting since it allows interaction and modification of objects, components and structures that do not exist at compile time.&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language. Lisp facilitates reflection through the use of an interpreter implemented in the same language. Unlike Smalltalk and Lisp, Java and C++ do not feature extensive built-in reflection facilities.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
What makes Ruby good for metaprogramming&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*Only slightly less malleable than Lisp (no macros)&lt;br /&gt;
*A fantastic syntax&lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. These methods are written in C. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer Appendix. &lt;br /&gt;
&lt;br /&gt;
Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of early binding .  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
====Examples ====&lt;br /&gt;
The code to find summation of a number without using templates can be given as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
int summation(int n) &lt;br /&gt;
{&lt;br /&gt;
    if (n == 0 )&lt;br /&gt;
       return 0;&lt;br /&gt;
    return n + summation(n - 1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void findsummation()&lt;br /&gt;
{&lt;br /&gt;
    int a = summation(5);   //a= (5+ 4 + 3 + 2 + 1 + 0) == 15&lt;br /&gt;
    int b = summation(0);  //b=0&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Now using templates the same program can be written as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
template &amp;lt;int N&amp;gt;&lt;br /&gt;
//TEMPLATE DEFINITION&lt;br /&gt;
struct Summation&lt;br /&gt;
{&lt;br /&gt;
    enum { value = N + Summation&amp;lt;N - 1&amp;gt;::value };  &lt;br /&gt;
};&lt;br /&gt;
template &amp;lt;&amp;gt;&lt;br /&gt;
struct Summation&amp;lt;0&amp;gt; &lt;br /&gt;
{&lt;br /&gt;
    enum { value = 0 };&lt;br /&gt;
};&lt;br /&gt;
Void findsummation()&lt;br /&gt;
{&lt;br /&gt;
    int a = Summation&amp;lt;5&amp;gt;::value; // == 15    // INSTANTIATION&lt;br /&gt;
    int b = Summation&amp;lt;0&amp;gt;::value; // == 1     // INSTANTIATION&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus with templates, the values of a and b were calculated at compile time rather than at run time. This was possible because 5 and 0 were literals, if they had been variables then their values wouldn’t have been known at compile time and hence a and b could not have been calculated at compile time.&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
Unlike Ruby, C++ does not support a built-in metaprogramming system aside from template metaprogramming. Template programming is also known as &amp;quot;programming at compile time&amp;quot;. Templates allow the compiler to determine certain variable and object types at compile time. The disadvantages of templates are : i) it is not specialized enough (C++ templates are Turing-complete. Often they can be used for collection classes but they can also be employed in metaprogramming. This can make it hard to figure out how templates can be used to solve a specific problem), ii) poor error messages (when errors occur at compile time due to incorrectness of templates, the error messages can be cryptic)&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22971</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22971"/>
		<updated>2009-10-08T16:38:45Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Metaprogramming in C++ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Metaprogramming is the writing of a program that writes other programs. Metaprogramming is not limited to o-o languages, but it seems that about half of the languages that support metaprogramming are object oriented. Consider how metaprogramming is done in the various languages, and give an example of writing a particular metaprogram in at least two of these languages to illustrate the differences. Since the Wikipedia article on metaprogramming is not very detailed, if you do a good job, you could submit this article to Wikipedia.&lt;br /&gt;
&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter. Source: Wikipedia&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprograms ==&lt;br /&gt;
&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code - see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they are replaced by the actual code during macro expansion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
Metaprogramming seems to have origniated in Lisp. John Foderaro mentions Lisp as a programmable programming language.&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in Ruby ===&lt;br /&gt;
Ruby is a dynamically-typed, interpreted, object oriented language. One of the unique aspects of Ruby is its extensive reflexive metaprogramming facilities.&lt;br /&gt;
&lt;br /&gt;
What makes Ruby good for metaprogramming&lt;br /&gt;
*Ruby is Dynamic and reflective&lt;br /&gt;
*Everything is open to change&lt;br /&gt;
*Blocks allow writing new control structures&lt;br /&gt;
*Most declarations are executable statements&lt;br /&gt;
*Only slightly less malleable than Lisp (no macros)&lt;br /&gt;
*A fantastic syntax&lt;br /&gt;
&lt;br /&gt;
For instance attr_reader, attr_writer, attr_accessor are inbuilt keywords that declare the object properties. These are actually not just syntax, but methods defined in Module. These methods are written in C. In other words, the ''object language'' here is Ruby but the ''metalanguage'' is C - Refer Appendix. &lt;br /&gt;
&lt;br /&gt;
Representing the functionality for the attr_reader method as a metaprogram in Ruby.&lt;br /&gt;
&lt;br /&gt;
 class Module&lt;br /&gt;
  def attr_reader (*syms)&lt;br /&gt;
    sys.each do |sym|&lt;br /&gt;
       class_eval %{def #{sym} @#{sym} end}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
=== Metaprogramming in C++ ===&lt;br /&gt;
&lt;br /&gt;
C++ provides for a type of metaprogramming called as [http://en.wikipedia.org/wiki/Template_metaprogramming template metaprograming]. Template Metaprogramming (TMP) is a programming technique that uses the priniciple of early binding .  This means that pieces of codes called templates are replaced by actual code including compile-time constants, data structures, and complete functions. Then the compiler puts together all the code and compiles it. Hence the compiler in a sense acts as a &amp;quot;virtual computer&amp;quot; [http://www.codeproject.com/KB/cpp/crc_meta.aspx] as it replaces parts of the program with instructions, which would otherwise have been done at run time. &lt;br /&gt;
&lt;br /&gt;
In TMP similar groups of lines of codes are replaced by a common template. Initially the template has to be defined with a base set of lines of code which are common in all. Then at the time of usage, templates have to be instantiated. Thus the templte definition specifies the general form of the code whereas the instantiation gives the specific lines of code formed from the template definition.&lt;br /&gt;
&lt;br /&gt;
=== Illustrating the differences ===&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22888</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22888"/>
		<updated>2009-10-08T04:27:46Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Metaprogramming style in various languages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Metaprogramming is the writing of a program that writes other programs. Metaprogramming is not limited to o-o languages, but it seems that about half of the languages that support metaprogramming are object oriented. Consider how metaprogramming is done in the various languages, and give an example of writing a particular metaprogram in at least two of these languages to illustrate the differences. Since the Wikipedia article on metaprogramming is not very detailed, if you do a good job, you could submit this article to Wikipedia.&lt;br /&gt;
&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter. Source: Wikipedia&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprogramming ==&lt;br /&gt;
Examples of Metaprograms&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code -- see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they generate the actual code during macro evalution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
* A metaprogram in Ruby &lt;br /&gt;
&lt;br /&gt;
A metaprogram in C++&lt;br /&gt;
=== A metaprogram in C++ ===&lt;br /&gt;
C++ supports a type of metaprogramming called template metaprogramming.Template Metaprogramming is a generic programming technique that uses extremely early binding. The compiler acts as an interpreter or a &amp;quot;virtual computer&amp;quot; that emits the instructions that make up the final program. It can be used for static configuration, adaptive programs, optimization and much more.[http://www.codeproject.com/KB/cpp/crc_meta.aspx]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 In template metaprogramming  In this a piece of code called template is used. The template has to be defined before use. Later whenever a simialr piece of code is to be used the template is instasiatied. The idea is to group simialr lines of code as a template. &lt;br /&gt;
&lt;br /&gt;
* Illustrating the differences&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22887</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22887"/>
		<updated>2009-10-08T04:26:23Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Metaprogramming style in various languages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Metaprogramming is the writing of a program that writes other programs. Metaprogramming is not limited to o-o languages, but it seems that about half of the languages that support metaprogramming are object oriented. Consider how metaprogramming is done in the various languages, and give an example of writing a particular metaprogram in at least two of these languages to illustrate the differences. Since the Wikipedia article on metaprogramming is not very detailed, if you do a good job, you could submit this article to Wikipedia.&lt;br /&gt;
&lt;br /&gt;
== What is Metaprogramming? ==&lt;br /&gt;
'''Meta-''' (from Greek: μετά = &amp;quot;after&amp;quot;, &amp;quot;beyond&amp;quot;, &amp;quot;with&amp;quot;, &amp;quot;adjacent&amp;quot;, &amp;quot;self&amp;quot;), is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter. Source: Wikipedia&lt;br /&gt;
&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples of Metaprogramming ==&lt;br /&gt;
Examples of Metaprograms&lt;br /&gt;
*the compiler or interpreter of your favourite language&lt;br /&gt;
*Lex and Yacc&lt;br /&gt;
*CORBA's IDL compiler&lt;br /&gt;
*a Quine (a program that, when executed, prints a copy of its own source code -- see QuineProgram for examples)&lt;br /&gt;
*Programs to generate EJB code and XML from database metadata &lt;br /&gt;
*Macros are nothing but special cases of metaprograms, as they generate the actual code during macro evalution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Metaprogramming style in various languages ==&lt;br /&gt;
&lt;br /&gt;
* A metaprogram in Ruby &lt;br /&gt;
&lt;br /&gt;
 A metaprogram in C++&lt;br /&gt;
=== A metaprogram in C++ ===&lt;br /&gt;
C++ supports a type of metaprogramming called template metaprogramming.Template Metaprogramming is a generic programming technique that uses extremely early binding. The compiler acts as an interpreter or a &amp;quot;virtual computer&amp;quot; that emits the instructions that make up the final program. It can be used for static configuration, adaptive programs, optimization and much more.[http://www.codeproject.com/KB/cpp/crc_meta.aspx]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 In template metaprogramming  In this a piece of code called template is used. The template has to be defined before use. Later whenever a simialr piece of code is to be used the template is instasiatied. The idea is to group simialr lines of code as a template. &lt;br /&gt;
&lt;br /&gt;
* Illustrating the differences&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Appendix ==&lt;br /&gt;
* Metalanguage: The language in which the metaprogram is written&lt;br /&gt;
* Object language: The language of the programs that are manipulated&lt;br /&gt;
* Reflection or Reflexivity: The ability of a programming language to be its own metalanguage&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22853</id>
		<title>CSC/ECE 517 Fall 2009/wiki2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki2_1_ma&amp;diff=22853"/>
		<updated>2009-10-08T02:59:13Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Metaprogramming is the writing of a program that writes other programs. Metaprogramming is not limited to o-o languages, but it seems that about half of the languages that support metaprogramming are object oriented. Consider how metaprogramming is done in the various languages, and give an example of writing a particular metaprogram in at least two of these languages to illustrate the differences. Since the Wikipedia article on metaprogramming is not very detailed, if you do a good job, you could submit this article to Wikipedia.&lt;br /&gt;
&lt;br /&gt;
= What is Metaprogramming? =&lt;br /&gt;
''Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data, or that do part of the work at compile time that would otherwise be done at runtime. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually, or it gives programs greater flexibility to efficiently handle new situations without recompilation.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Examples of Metaprogramming =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Metaprogramming style in various languages =&lt;br /&gt;
&lt;br /&gt;
== A metaprogram in Ruby ==&lt;br /&gt;
&lt;br /&gt;
== A metaprogram in JAVA ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Illustrating the differences ==&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wik2_1_ma&amp;diff=22806</id>
		<title>CSC/ECE 517 Fall 2009/wik2 1 ma</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wik2_1_ma&amp;diff=22806"/>
		<updated>2009-10-08T01:41:13Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Topic=&lt;br /&gt;
Metaprogramming is the writing of a program that writes other programs. Metaprogramming is not limited to o-o languages, but it seems that about half of the languages that support metaprogramming are object oriented. Consider how metaprogramming is done in the various languages, and give an example of writing a particular metaprogram in at least two of these languages to illustrate the differences. Since the Wikipedia article on metaprogramming is not very detailed, if you do a good job, you could submit this article to Wikipedia&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22248</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22248"/>
		<updated>2009-09-28T23:31:06Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* External Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
 &lt;br /&gt;
==Guidelines to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases and record the results.&lt;br /&gt;
# &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; should review the results and report any bugs to the developers.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers (dummy control modules used instead of the actual modules for the purpose of testing) to be written. Although a number of [http://en.wikipedia.org/wiki/Test_stubs stubs] have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of [http://en.wikipedia.org/wiki/Test_stubs stubs] and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Sample Integration test case Templates can be found at [http://it.toolbox.com/blogs/enterprise-solutions/deliverable-integration-test-cases-29932 Integration test cases]&lt;br /&gt;
&lt;br /&gt;
Integration test plan Templates can be found at [http://geekswithblogs.net/dthakur/articles/10430.aspx Integration test plans]&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://it.toolbox.com/blogs/enterprise-solutions/deliverable-integration-test-cases-29932 Integration test cases]&lt;br /&gt;
# [http://geekswithblogs.net/dthakur/articles/10430.aspx Integration test plans]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22247</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22247"/>
		<updated>2009-09-28T23:30:22Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
 &lt;br /&gt;
==Guidelines to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases and record the results.&lt;br /&gt;
# &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; should review the results and report any bugs to the developers.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers (dummy control modules used instead of the actual modules for the purpose of testing) to be written. Although a number of [http://en.wikipedia.org/wiki/Test_stubs stubs] have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of [http://en.wikipedia.org/wiki/Test_stubs stubs] and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Sample Integration test case Templates can be found at [http://it.toolbox.com/blogs/enterprise-solutions/deliverable-integration-test-cases-29932 Integration test cases]&lt;br /&gt;
&lt;br /&gt;
Integration test plan Templates can be found at [http://geekswithblogs.net/dthakur/articles/10430.aspx Integration test plans]&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://it.toolbox.com/blogs/enterprise-solutions/deliverable-integration-test-cases-29932 Integration test cases]&lt;br /&gt;
# [http://geekswithblogs.net/dthakur/articles/10430.aspx Integration Test Plan]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22246</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22246"/>
		<updated>2009-09-28T23:29:50Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* External Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
 &lt;br /&gt;
==Guidelines to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases and record the results.&lt;br /&gt;
# &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; should review the results and report any bugs to the developers.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers (dummy control modules used instead of the actual modules for the purpose of testing) to be written. Although a number of [http://en.wikipedia.org/wiki/Test_stubs stubs] have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of [http://en.wikipedia.org/wiki/Test_stubs stubs] and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Sample Integration test case Templates can be found at [http://it.toolbox.com/blogs/enterprise-solutions/deliverable-integration-test-cases-29932 deliverable integration test cases]&lt;br /&gt;
&lt;br /&gt;
Integration test plan Templates can be found at [http://geekswithblogs.net/dthakur/articles/10430.aspx Integration test plans]&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://it.toolbox.com/blogs/enterprise-solutions/deliverable-integration-test-cases-29932 Integration test cases]&lt;br /&gt;
# [http://geekswithblogs.net/dthakur/articles/10430.aspx Integration Test Plan]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22245</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22245"/>
		<updated>2009-09-28T23:28:23Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* How To write good Integration Test Cases and do effective Integration Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
 &lt;br /&gt;
==Guidelines to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases and record the results.&lt;br /&gt;
# &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; should review the results and report any bugs to the developers.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers (dummy control modules used instead of the actual modules for the purpose of testing) to be written. Although a number of [http://en.wikipedia.org/wiki/Test_stubs stubs] have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of [http://en.wikipedia.org/wiki/Test_stubs stubs] and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Sample Integration test case Templates can be found at [http://it.toolbox.com/blogs/enterprise-solutions/deliverable-integration-test-cases-29932 deliverable integration test cases]&lt;br /&gt;
&lt;br /&gt;
Integration test plan Templates can be found at [http://geekswithblogs.net/dthakur/articles/10430.aspx Integration test plans]&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22243</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22243"/>
		<updated>2009-09-28T23:20:49Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Integration Test approaches */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
 &lt;br /&gt;
==Guidelines to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases and record the results.&lt;br /&gt;
# &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; should review the results and report any bugs to the developers.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers (dummy control modules used instead of the actual modules for the purpose of testing) to be written. Although a number of [http://en.wikipedia.org/wiki/Test_stubs stubs] have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of [http://en.wikipedia.org/wiki/Test_stubs stubs] and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22241</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22241"/>
		<updated>2009-09-28T23:12:14Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Integration Test approaches */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
 &lt;br /&gt;
==Guidelines to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases and record the results.&lt;br /&gt;
# &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; should review the results and report any bugs to the developers.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of [http://en.wikipedia.org/wiki/Test_stubs stubs] have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22240</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22240"/>
		<updated>2009-09-28T23:11:43Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Integration Test approaches */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
 &lt;br /&gt;
==Guidelines to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases and record the results.&lt;br /&gt;
# &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; should review the results and report any bugs to the developers.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of [[http://en.wikipedia.org/wiki/Test_stubs stubs]] have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22228</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=22228"/>
		<updated>2009-09-28T22:44:06Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Steps to write good Functional Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
 &lt;br /&gt;
==Guidelines to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases and record the results.&lt;br /&gt;
# &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; should review the results and report any bugs to the developers.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21781</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21781"/>
		<updated>2009-09-24T18:47:10Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
 &lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases and record the results.&lt;br /&gt;
# &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; should review the results and report any bugs to the developers.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21697</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21697"/>
		<updated>2009-09-22T03:49:23Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Steps to write good Functional Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases and record the results.&lt;br /&gt;
# &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; should review the results and report any bugs to the developers.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21684</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21684"/>
		<updated>2009-09-22T03:33:03Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Steps to write good Functional Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21682</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21682"/>
		<updated>2009-09-22T03:32:20Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Steps to write good Functional Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared so as to not affect further tests or rerunning of the same test case. Hence the Author should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21680</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21680"/>
		<updated>2009-09-22T03:29:58Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Functional Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black-box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared as as to not effect further tests or rerunning of the same test case. Hence the Author should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21679</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21679"/>
		<updated>2009-09-22T03:29:38Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in Software Testing. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as [[Black-box testing]], as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared as as to not effect further tests or rerunning of the same test case. Hence the Author should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21677</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21677"/>
		<updated>2009-09-22T03:28:05Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Functional Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in [[Software Testing]]. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as [[Black-box testing]], as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared as as to not effect further tests or rerunning of the same test case. Hence the Author should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21676</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21676"/>
		<updated>2009-09-22T03:27:35Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Functional Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in [[Software Testing]]. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as [Black-box testing], as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared as as to not effect further tests or rerunning of the same test case. Hence the Author should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21674</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21674"/>
		<updated>2009-09-22T03:26:32Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in [[Software Testing]]. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of Software Tests are mentioned, which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared as as to not effect further tests or rerunning of the same test case. Hence the Author should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21671</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21671"/>
		<updated>2009-09-22T03:19:45Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* External Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in [[Software Testing]]. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of software Tests are mentioned which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared as as to not effect further tests or rerunning of the same test case. Hence the Author should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
# [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21668</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21668"/>
		<updated>2009-09-22T03:18:25Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in [[Software Testing]]. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of software Tests are mentioned which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared as as to not effect further tests or rerunning of the same test case. Hence the Author should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
Another Example of Test Cases can be found at [http://math-cs.gordon.edu/courses/cs211/ATMExample/InitialFunctionalTests.html Initial Functional Test Cases for an ATM system]&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21666</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21666"/>
		<updated>2009-09-22T03:09:55Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* Steps to write good Functional Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in [[Software Testing]]. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of software Tests are mentioned which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# Usually the same test cases are run a number of times. Hence after executing a test case, any data added to the system should be cleared as as to not effect further tests or rerunning of the same test case. Hence the Author should also give post-test setup details.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21665</id>
		<title>CSC/ECE 517 Fall 2009/wiki1b 4 mv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2009/wiki1b_4_mv&amp;diff=21665"/>
		<updated>2009-09-22T03:04:25Z</updated>

		<summary type="html">&lt;p&gt;Mjampal: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Unit Testing is given a lot of importance in [[Software Testing]]. But functional and integration testing are essential too. Hence Functional and Integration Testing is discussed here. This page provides an introduction to these testing methods; also including the good practices to write functional and integration tests. Later additional types of software Tests are mentioned which could  be used to gain further confidence that one's code is correct.&lt;br /&gt;
&lt;br /&gt;
=Functional Testing= &lt;br /&gt;
Functional testing is the process of testing of all the functions of a system, ensuring that the system conforms to the user requirements and specifications. It is sometimes referred to as black box testing, as it does not require understanding of the internal structure of the implementation. &lt;br /&gt;
&lt;br /&gt;
Functional testing can be done by using manual or automated methods[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]. In both the methods, a series of tests have to be run marking the interaction between the user and the system, ensuring that the system performs as it was supposed to. Since Use cases mainly depict the interaction between the user and system, functional test suites are created from requirement use cases, with each scenario becoming a functional test[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References].   &lt;br /&gt;
&lt;br /&gt;
==Functional Test Plan==&lt;br /&gt;
&amp;quot;The functional test plan measures the quality of the functional components of the system[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&amp;quot;. The test plan is written by the &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt;. The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; lists a number of test cases, containing the input, expected results, and pre and post-test setup. After a module is unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; executes the functional test cases and records the actual results. The &amp;lt;i&amp;gt;Reviewer&amp;lt;/i&amp;gt; compares the Actual results with the expected results and reports whether each test case passed or failed the test.&lt;br /&gt;
&lt;br /&gt;
==Steps to write good Functional Tests== &lt;br /&gt;
# The test plan must be written by persons who have extensive knowledge of the business requirements. It is advisable that the developers do not write the test plans. This is because developers tend to unknowingly write test cases whose functionality is based on the implementation rather than the initial functional specifications.&lt;br /&gt;
# The functional test plans should be created as early as possible, probably as soon as the functional specifications are ready.&lt;br /&gt;
# The functional test plan should be updated when there are changes in the business requirements.&lt;br /&gt;
# For each functionality, a list of test cases should be defined so that each aspect of the functionality is covered. &lt;br /&gt;
# The &amp;lt;i&amp;gt;Author&amp;lt;/i&amp;gt; should clearly include the pre-test setup for the test cases so that the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; can easily execute the test cases. &lt;br /&gt;
# The Author should also provide post-test setup which has instructions on how to clear any data that would prevent the test case from being executed more than once.&lt;br /&gt;
# As a module is built and unit tested, the &amp;lt;i&amp;gt;Tester&amp;lt;/i&amp;gt; should execute the particular test cases.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Examples of pre-test setup, test cases and post-test setup are given below. The complete reference for the example can be found at [http://www.developer.com/java/ent/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
&lt;br /&gt;
The pre-test setup for Test Case: &amp;lt;i&amp;gt;Create new user profile&amp;lt;/i&amp;gt; can be given as:&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username:     &amp;quot;A&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; first name:   &amp;quot;John&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; last name:    &amp;quot;Smith&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; access level: &amp;quot;read-only&amp;quot;]&lt;br /&gt;
       [UserName: &amp;quot;A&amp;quot;: --&amp;gt; password:     &amp;quot;profile1&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
The test cases for the function:&amp;lt;i&amp;gt;Verify that only valid users can access the system&amp;lt;/i&amp;gt; can be given as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;table cellspacing=&amp;quot;2&amp;quot; width=900 border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot; bgcolor=&amp;quot;#99ffff&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Test Case #&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Required Input&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Expected Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;th&amp;gt;Results&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th&amp;gt;Pass/Fail&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td colspan=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that only valid users can access the system.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Verify that valid users cannot access the system without entering a valid password.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Navigate to the login screen&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Login screen with release number A is loaded.&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;quot;INVALIDUSER&amp;quot;, password &amp;quot;INVALIDUSER&amp;quot;, and click on login button&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Error message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;User name is not found&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;3&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;:--&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;quot;test&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;Error Message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Password for user &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; is invalid&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr valign=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;td&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;Enter user name &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; username&amp;amp;#93;&amp;lt;/b&amp;gt; and password &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; password&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;The main page is loaded with a message:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;quot;Welcome &amp;lt;b&amp;gt;&amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; first name&amp;amp;#93; &amp;amp;#91;UserName: &amp;quot;A&amp;quot;: --&amp;amp;gt; last name&amp;amp;#93;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The post-test setup for the above scenario can be given as:&lt;br /&gt;
       Remove [UserName: &amp;quot;A&amp;quot;: --&amp;gt; username: &amp;quot;A&amp;quot;] from the LDAP Server.&lt;br /&gt;
&lt;br /&gt;
=Integration Testing=&lt;br /&gt;
Integration Testing is a process of testing the application on the whole. After going through the unit testing of the modules, these modules need to be integrated, and during this process things may go wrong, Integration process is the phase wherein these errors are captured and rectified.&lt;br /&gt;
It is very common for modules after having successful passed all the unit test cases to fail when they are integrated with other modules. Integration testing is an important phase and sometimes there are separate teams which handle integration testing. &lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;strong&amp;gt;DEFINITION:&amp;lt;/strong&amp;gt;&amp;lt;i&amp;gt;Integration testing is a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with interfacing. The objective is to take unit tested components&lt;br /&gt;
and build a program structure that has been dictated by design.&amp;lt;/i&amp;gt;[http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2009/wiki1b_4_mv#References]&lt;br /&gt;
&lt;br /&gt;
==Integration Test approaches== &lt;br /&gt;
Integration testing can be done in a variety of ways [[Image:TopDown_Approach.jpg|thumb|Top Down Approach]]&lt;br /&gt;
# '''Top-Down Approach.''' In this approach the modules higher up in the control hierarchy are integrated first and low-level modules are added later. The advantage of this approach is that the modules with high level logic are tested first and hence bugs in the crucial logic are caught early. Further this approach does not require drivers to be written. Although a number of stubs have to be written and managed &lt;br /&gt;
# '''Bottom Up Approach.''' In this approach, the low level modules are integrated first and high level logic is tested late. While integrating the low level modules, the control modules are replaced by dummy modules called as drivers. Thus driver codes have to be written and managed while using this approach. [[Image:BottomUp_Approach.jpg|thumb|Bottom Up Approach]] &lt;br /&gt;
# '''Umbrella approach.''' Another approach is called the umbrella approach. It is a hybrid of the top down and the botom up approach, ie both the bottom up and top down approaches are used.In this approach we first test along the functional and control flow paths, for this we use the bottom up approach. The results thus gathered are later integrated in a top down manner. This kind of testing allows creating early prototypes of the system with has limited functionality thereby helping is the creations of the product in an incremental manner. This types of testing also minimizes the use of stubs and drivers which are needed in the top-down and bottom up approaches.&lt;br /&gt;
==Prerequisites before Integration Testing==&lt;br /&gt;
The system that is being tested, all of its modules should be rigorously tested as a component, i.e they should have gone through unit tests.&lt;br /&gt;
==Steps to write good Integration Test Cases==&lt;br /&gt;
#Create a Test Plan&lt;br /&gt;
#Create test cases and the sample data against which they would be tested.&lt;br /&gt;
#If automated tools are being used, scripts should be created.&lt;br /&gt;
#After the components have been integrated, start executing the test cases created in point 2.&lt;br /&gt;
#Log the bugs found and rectify the same.&lt;br /&gt;
#Retest the code.&lt;br /&gt;
&lt;br /&gt;
==How To write good Integration Test Cases and do effective Integration Testing==&lt;br /&gt;
The main focus of integration testing is that it needs to check whether the different components are working smoothly and are interacting with each other in the proper manner. The Integration test cases specifically focus on the flow of data/information/control from one component to the other.&lt;br /&gt;
A few thing that needs to be kept in mind for effective integration testing are&lt;br /&gt;
# Ensure that the correct versions of the components are integrated together.&lt;br /&gt;
# Automate the integration of components so that there is lesser chance for human error.&lt;br /&gt;
# Log all the errors that have been found and document them with the solutions as well as the version number so that we could keep track of which build was being tested when the error was discovered.&lt;br /&gt;
&lt;br /&gt;
=Beyond Functional and Integration Testing=&lt;br /&gt;
[[Image:TestPhase.jpg|thumb|Test Phases]]&lt;br /&gt;
Integration and Functional testing are not the only testing that are done for checking the validity of the system. Other test cases includes:&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Unit Testing:''' This is the first stage where the developer tests the component he/she is creating. More can be found at [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Validation Testing:''' After integration Testing, validation testing takes place wherein checks are made to ensure that the functional requirements are satisfied.&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Alpha and Beta Testing:'''When the product about to be released, it is first exposed to some end users who test the application. This is alpha beta testing. More can be found at [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha and Beta Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Recovery Testing:''' In this phase the system is made to crash and is used to check to see if it recovers in the proper manner. More can be found at [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Security Testing:''' Systems that store and record sensitive information need to be protected from threats, in this phase the systems protection mechanisms are tested. More can be found at [http://en.wikipedia.org/wiki/Security_testing Security Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Stress Testing:'''The system is overloaded with data and it is checked to whether it crashes. More can be found at [http://en.wikipedia.org/wiki/Stress_testing Stress Testing] &amp;lt;br /&amp;gt;&lt;br /&gt;
'''Performance Testing:''' It tests the run time performance of software within the context of the system. More can be found at [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Smoke Testing:'''  smoke testing is a preliminary to further testing, which should reveal simple failures severe enough to reject a prospective software release. More can be found at [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&amp;lt;br/&amp;gt;&lt;br /&gt;
'''Acceptance Testing:''' acceptance testing performed by the customer is known as user acceptance testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field (acceptance) testing. More can be found at [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://www.segue.com/pdf/automated_functional_testing.pdf Automated Functional Testing]&lt;br /&gt;
# [http://searchsoftwarequality.techtarget.com/generic/0,295582,sid92_gci1303938,00.html# Functional Tests to ensure Software Quality]&lt;br /&gt;
# [http://www.developer.com/tech/article.php/3623476/Functional-Test-Plans-The-Right-Way.htm Functional Test Plans]&lt;br /&gt;
# Software Engineering: A Practitioner's Approach by Roger S. Pressman ISBN 0073655783&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Unit_testing Unit Testing]&lt;br /&gt;
# [http://www.majordojo.com/uploads/AlphaBetaTesting.pdf Alpha Beta Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Recovery_testing Recovery Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Security_testing Security Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Stress_testing Stress Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Performance_testing Performance Testing]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Smoke_test Smoke Test]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Acceptance_testing Acceptance Testing]&lt;/div&gt;</summary>
		<author><name>Mjampal</name></author>
	</entry>
</feed>