<?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=Ggsingh</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=Ggsingh"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ggsingh"/>
	<updated>2026-07-15T05:49:36Z</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_2012/ch2b_2w46_ga&amp;diff=70794</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w46 ga</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w46_ga&amp;diff=70794"/>
		<updated>2012-11-19T21:44:46Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Builder Pattern and a directory of sites=&lt;br /&gt;
Internet has grown to be the new generation prime source of information. The objective of this page is to compile a directory of websites that discuss one of the Object Oriented Design pattern called the Builder Pattern. The aim of this wiki-page is to compile the best resources available online for studying the [http://en.wikipedia.org/wiki/Builder_pattern Builder Pattern]. &lt;br /&gt;
This page will take the reader systematically through the best articles that can be referenced at every point of study of the topic in discussion. There is also a list of interesting video tutorials and discussions on online forums regarding the Builder Design Pattern  &lt;br /&gt;
&lt;br /&gt;
==Scenarios==&lt;br /&gt;
The best way to learn about a [http://en.wikipedia.org/wiki/Design_pattern Design Pattern] is to begin with the scenarios that it can be implemented in. It is important to understand what real life situations and design issues necessitate the use of a pattern. It gives our study a more practical approach than simply beginning with the definitions of the patterns. This approach of studying begins with an exemplary motivation to study the pattern in the first place. There are a lot of interesting scenarios that highlight the need for the Builder Pattern, some of which are present in the following links. &lt;br /&gt;
&lt;br /&gt;
'''Animal model making example:-'''&lt;br /&gt;
http://www.codeproject.com/Articles/42415/Builder-Design-Pattern&lt;br /&gt;
&lt;br /&gt;
*This article in codeproject.com explains one simple scenario where a builder pattern is implemented. A day care teacher needs to maintain a set of moulds for creating clay animals. Each set consists of tools like head, body, tail, arm and leg of a particular animal. Each of these tools are used to create individual parts of the animal that are then compiled together to form a complete figure.&lt;br /&gt;
&lt;br /&gt;
'''Instrument manufacturing example:-'''&lt;br /&gt;
http://mahemoff.com/paper/software/gofMetaphors/builder.shtml&lt;br /&gt;
&lt;br /&gt;
*Here, we see how the Builder Pattern could be used to implement a generic Instrument manufacturing system that can be used to not only specialise the kind of instrument being built but also the kind of users interacting with the system.&lt;br /&gt;
&lt;br /&gt;
Each of the other resources cited on this page also contain different scenarios in which the Builder Pattern can be implemented.&lt;br /&gt;
&lt;br /&gt;
==Definition==&lt;br /&gt;
The definition by the Gang of Four states that the Builder Pattern separates the construction of a complex object from its representation so that the same construction process can create different representations. &lt;br /&gt;
It is a type of creational pattern that focuses on constructing complex objects step by step. This pattern is very similar to the [http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory design pattern].&lt;br /&gt;
&lt;br /&gt;
Typically, languages like Java provide constructors to create objects. But there are multiple problems that start creeping in if there are many different objects that take many different parameters that can be classified as either optional or mandatory.&lt;br /&gt;
&lt;br /&gt;
The detailed explanations can be found at the following links:-&lt;br /&gt;
&lt;br /&gt;
http://www.javacodegeeks.com/2012/07/builder-design-pattern-in-java.html&lt;br /&gt;
&lt;br /&gt;
*One interesting blog that aptly explains the builder pattern and the problems that it solves. &lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/builder-pattern.html&lt;br /&gt;
&lt;br /&gt;
*This link also provides good literature on motivations for using the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
==Design Pattern Structure==&lt;br /&gt;
In this pattern, a process is used to create complex objects by only specifying its type and contents. The details related to the object’s representation like the actual steps involved in creating the complex object are encapsulated. In this way, the same process can be used to create different object forms. &lt;br /&gt;
&lt;br /&gt;
[[File:Builder UML class diagram.svg.png]]&lt;br /&gt;
&lt;br /&gt;
The pattern consists of four main parts :- &lt;br /&gt;
 * Builder, &lt;br /&gt;
 * Concrete Builder, &lt;br /&gt;
 * Director and &lt;br /&gt;
 * Product.&lt;br /&gt;
&lt;br /&gt;
A Builder is an interface that holds actions involved in creating the complex object. The complex object that is being created here is represented by the Product. &lt;br /&gt;
&lt;br /&gt;
The Concrete Builder create and assemble the parts that constitute the Product object. They implement the Builder interface. &lt;br /&gt;
&lt;br /&gt;
The Director object is responsible for constructing the Product by delegating the actual creation and assembly to the appropriate Concrete Builder. &lt;br /&gt;
&lt;br /&gt;
The design pattern structure is explained quite well in the link:-&lt;br /&gt;
 &lt;br /&gt;
http://www.avajava.com/tutorials/lessons/builder-pattern.html?page=1&lt;br /&gt;
&lt;br /&gt;
Further reading&lt;br /&gt;
&lt;br /&gt;
http://java.dzone.com/news/design-pattern-builder-pattern&lt;br /&gt;
 &lt;br /&gt;
This link gives a good explanation of how the four modules co-ordinate together to solve the object creation problem in a clean and Object-Oriented manner.&lt;br /&gt;
&lt;br /&gt;
==Implementation Examples==&lt;br /&gt;
The semantics and methods of implementing the Builder Pattern differ with the language chosen. The following links contain detailed implementation of the Builder Pattern in different scenarios&lt;br /&gt;
&lt;br /&gt;
'''Java'''&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/builder/java/2&lt;br /&gt;
&lt;br /&gt;
The scenario of a customer ordering a pizza at a restaurant&lt;br /&gt;
&lt;br /&gt;
'''C#'''&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/builder/c%2523&lt;br /&gt;
&lt;br /&gt;
The generic scenario&lt;br /&gt;
&lt;br /&gt;
'''C++'''&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/builder/cpp/1&lt;br /&gt;
&lt;br /&gt;
The scenario is of distributing work over different operating systems.&lt;br /&gt;
&lt;br /&gt;
'''PHP'''&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/builder/php/1&lt;br /&gt;
&lt;br /&gt;
This link gives the implementation of Builder pattern in PhP. The example taken here is of creating an HTML page wherein the Director gives the Builder parameters like the page title, page heading, page data among the others to construct an HTML page as the Product.&lt;br /&gt;
&lt;br /&gt;
==Difference between Builder Pattern and Factory Pattern==&lt;br /&gt;
The most common confusion in Design Patterns is the distinction between Builder and the Factory Pattern. A very explanatory discussion on the difference between the two patterns that is worth following is at &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/757743/what-is-the-difference-between-builder-design-pattern-and-factory-design-pattern&lt;br /&gt;
&lt;br /&gt;
Both these patterns are designed to achieve the same objective of building complex structured objects. The difference is in the approach though. Factory pattern describes an object that knows how to create several different but related kinds of object in one step, where the specific type is chosen based on given parameters.Builder pattern describes an object that knows how to craft another object of a specific type over several steps.&lt;br /&gt;
Thus unlike factory pattern, builder pattern has a sequential step-by-step approach wherein each step has a small logic that adds value to the construction and the object will be returned as the result of the last step. &lt;br /&gt;
A small but enough explanatory article on Factory Pattern can be found at &lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/abstract-factory-pattern/&lt;br /&gt;
&lt;br /&gt;
following which the next article can clearly explain the difference between the two patterns &lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/builder-pattern/&lt;br /&gt;
&lt;br /&gt;
==Related concepts and terms==&lt;br /&gt;
*Builder focuses on constructing a complex object step by step. [http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory] emphasizes a family of product objects (either simple or complex). Builder returns the product as a final step, but as far as the Abstract Factory is concerned, the product gets returned immediately.&lt;br /&gt;
*Builder often builds a Composite.&lt;br /&gt;
*Often, designs start out using Factory Method (less complicated, more customizable, subclasses proliferate) and evolve toward Abstract Factory, Prototype, or Builder (more flexible, more complex) as the designer discovers where more flexibility is needed.&lt;br /&gt;
*Sometimes creational patterns are complementary: Builder can use one of the other patterns to implement which components are built. Abstract Factory, Builder, and Prototype can useSingleton in their implementations.&lt;br /&gt;
*Builders are good candidates for a fluent interface.&lt;br /&gt;
&lt;br /&gt;
==Video Tutorials==&lt;br /&gt;
&lt;br /&gt;
The video tutorials listed here carry explanations along with code implementations:-&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=jstef_eUM6E&lt;br /&gt;
&lt;br /&gt;
*This 9 minute video tutorial by questpond.com is a conceptual explanation of the Builder Pattern with the help of 2 real life examples of tea preparation and one of generating reports. The video also illustrates a detailed Java implementation of the report generation system. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=9XnsOpjclUg&lt;br /&gt;
&lt;br /&gt;
*This 13 minute video tutorial by newthinktank.com illustrates a full fledged implementation of a Robot building system using the Builder Pattern.&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=1xo_sVKcHbY&lt;br /&gt;
&lt;br /&gt;
*This 9 minute video tutorial by zaneacademy gives a thorough explaantion of the key idea behind the Builder Pattern and its basic characteristics. It then goes on to explain the UML diagram of the Builder Pattern with an example. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=L-iKVzW56mY&amp;amp;playnext=1&amp;amp;list=PL39AB9FE0F96FADA5&amp;amp;feature=results_video&lt;br /&gt;
&lt;br /&gt;
*This 9 minute video tutorial by questpond.com about the implementation of the Builder Pattern in Java. We see an in-depth analysis of a car building system and how the builder pattern is used in its implementation. The video contains a complete code run of the example and the various methods used. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=S9p_mwz1dd4&lt;br /&gt;
&lt;br /&gt;
*The study of design patterns is complete only when one can differentiate between the various patterns This 12 minute video&lt;br /&gt;
&lt;br /&gt;
==Online Discussions==&lt;br /&gt;
These are some interesting online discussions on various issues related to the Builder Pattern&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/5211039/real-world-examples-of-the-builder-pattern&lt;br /&gt;
&lt;br /&gt;
*In this discussion on stackoverflow, the members are citing some personal coding experiences where the used the Builder Pattern and how. &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/328496/when-would-you-use-the-builder-pattern?lq=1&lt;br /&gt;
&lt;br /&gt;
*In this discussion on stackoverflow, the members are discussing various situations where the Builder Pattern scores over the Factory pattern, the Telescoping Constructor pattern and the JavaBean pattern. The differences between the patterns become clearer through this discussion. What is even more useful is that one of the participants of the discussion has also posted an implementation to highlight the difference. &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4737836/can-the-builder-pattern-ever-be-doing-too-much?rq=1&lt;br /&gt;
&lt;br /&gt;
*This is an interesting discussion where members discuss how the builder pattern trades off against the factory pattern not just conceptually but in actual practice. This discussion gives hints at choosing the best design pattern for a situation and what questions one must ask oneself before finalising the design pattern. &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/5674513/differences-between-builder-pattern-vs-template-method?rq=1&lt;br /&gt;
&lt;br /&gt;
*This discussion on stackoverflow.com is about the difference between the builder pattern and the template pattern. It also highlights the crucial distinctions between other patterns as well. &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/10941464/builder-pattern-with-inheritance?rq=1&lt;br /&gt;
&lt;br /&gt;
*This is an interesting discussion of using the Builder Pattern in an inheritance hierarchy. &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/7302891/the-builder-pattern-and-a-large-number-of-mandatory-parameters?rq=1&lt;br /&gt;
&lt;br /&gt;
*This discussion on stackoverflow focusses on the general good practices that can be used while implementing the Builder pattern. Which secondary design decisions are helpful and which could raise problems during implementation. The members are each giving their own implementation practices and how they trade off when compared to other conventions followed while implementing the Builder pattern.&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w46_ga&amp;diff=70331</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w46 ga</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w46_ga&amp;diff=70331"/>
		<updated>2012-11-18T20:32:07Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Wiki Formatted&lt;br /&gt;
=Builder Pattern and a directory of sites=&lt;br /&gt;
Internet has grown to be the new generation prime source of information. The objective of this page is to compile a directory of websites that discuss one of the Object Oriented Design pattern called the Builder Pattern. The aim of this wiki-page is to compile the best resources available online for studying the [http://en.wikipedia.org/wiki/Builder_pattern Builder Pattern].&lt;br /&gt;
&lt;br /&gt;
==Scenarios==&lt;br /&gt;
The best way to learn about a [http://en.wikipedia.org/wiki/Design_pattern Design Pattern] is to begin with the scenarios that it can be implemented in. It is important to understand what real life situations and design issues necessitate the use of a pattern. It gives our study a more practical approach than simply beginning with the definitions of the patterns. This approach of studying begins with an exemplary motivation to study the pattern in the first place. There are a lot of interesting scenarios that highlight the need for the Builder Pattern, some of which are present in the following links. &lt;br /&gt;
&lt;br /&gt;
'''Animal model making example:-'''&lt;br /&gt;
http://www.codeproject.com/Articles/42415/Builder-Design-Pattern&lt;br /&gt;
&lt;br /&gt;
*This article in codeproject.com explains one simple scenario where a builder pattern is implemented. A day care teacher needs to maintain a set of moulds for creating clay animals. Each set consists of tools like head, body, tail, arm and leg of a particular animal. Each of these tools are used to create individual parts of the animal that are then compiled together to form a complete figure.&lt;br /&gt;
&lt;br /&gt;
'''Instrument manufacturing example:-'''&lt;br /&gt;
http://mahemoff.com/paper/software/gofMetaphors/builder.shtml&lt;br /&gt;
&lt;br /&gt;
*Here, we see how the Builder Pattern could be used to implement a generic Instrument manufacturing system that can be used to not only specialise the kind of instrument being built but also the kind of users interacting with the system.&lt;br /&gt;
&lt;br /&gt;
Each of the other resources cited on this page also contain different scenarios in which the Builder Pattern can be implemented.&lt;br /&gt;
&lt;br /&gt;
==Definition==&lt;br /&gt;
The definition by the Gang of Four states that the Builder Pattern separates the construction of a complex object from its representation so that the same construction process can create different representations. &lt;br /&gt;
It is a type of creational pattern that focuses on constructing complex objects step by step. This pattern is very similar to the [http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory design pattern].&lt;br /&gt;
&lt;br /&gt;
Typically, languages like Java provide constructors to create objects. But there are multiple problems that start creeping in if there are many different objects that take many different parameters that can be classified as either optional or mandatory.&lt;br /&gt;
&lt;br /&gt;
The detailed explanations can be found at the following links:-&lt;br /&gt;
&lt;br /&gt;
http://www.javacodegeeks.com/2012/07/builder-design-pattern-in-java.html&lt;br /&gt;
&lt;br /&gt;
*One interesting blog that aptly explains the builder pattern and the problems that it solves. &lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/builder-pattern.html&lt;br /&gt;
&lt;br /&gt;
*This link also provides good literature on motivations for using the builder design pattern.&lt;br /&gt;
&lt;br /&gt;
==Design Pattern Structure==&lt;br /&gt;
In this pattern, a process is used to create complex objects by only specifying its type and contents. The details related to the object’s representation like the actual steps involved in creating the complex object are encapsulated. In this way, the same process can be used to create different object forms. &lt;br /&gt;
&lt;br /&gt;
[[File:Builder UML class diagram.svg.png]]&lt;br /&gt;
&lt;br /&gt;
The pattern consists of four main parts :- &lt;br /&gt;
 * Builder, &lt;br /&gt;
 * Concrete Builder, &lt;br /&gt;
 * Director and &lt;br /&gt;
 * Product.&lt;br /&gt;
&lt;br /&gt;
A Builder is an interface that holds actions involved in creating the complex object. The complex object that is being created here is represented by the Product. &lt;br /&gt;
&lt;br /&gt;
The Concrete Builder create and assemble the parts that constitute the Product object. They implement the Builder interface. &lt;br /&gt;
&lt;br /&gt;
The Director object is responsible for constructing the Product by delegating the actual creation and assembly to the appropriate Concrete Builder. &lt;br /&gt;
&lt;br /&gt;
The design pattern structure is explained quite well in the link:-&lt;br /&gt;
 &lt;br /&gt;
http://www.avajava.com/tutorials/lessons/builder-pattern.html?page=1&lt;br /&gt;
&lt;br /&gt;
Further reading&lt;br /&gt;
&lt;br /&gt;
http://java.dzone.com/news/design-pattern-builder-pattern&lt;br /&gt;
 &lt;br /&gt;
This link gives a good explanation of how the four modules co-ordinate together to solve the object creation problem in a clean and Object-Oriented manner.&lt;br /&gt;
&lt;br /&gt;
==Implementation Examples==&lt;br /&gt;
The semantics and methods of implementing the Builder Pattern differ with the language chosen. The following links contain detailed implementation of the Builder Pattern in different scenarios&lt;br /&gt;
&lt;br /&gt;
'''Java'''&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/builder/java/2&lt;br /&gt;
&lt;br /&gt;
The scenario of a customer ordering a pizza at a restaurant&lt;br /&gt;
&lt;br /&gt;
'''C#'''&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/builder/c%2523&lt;br /&gt;
&lt;br /&gt;
The generic scenario&lt;br /&gt;
&lt;br /&gt;
'''C++'''&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/builder/cpp/1&lt;br /&gt;
&lt;br /&gt;
The scenario is of distributing work over different operating systems.&lt;br /&gt;
&lt;br /&gt;
'''PHP'''&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/builder/php/1&lt;br /&gt;
&lt;br /&gt;
This link gives the implementation of Builder pattern in PhP. The example taken here is of creating an HTML page wherein the Director gives the Builder parameters like the page title, page heading, page data among the others to construct an HTML page as the Product.&lt;br /&gt;
&lt;br /&gt;
==Related concepts and terms==&lt;br /&gt;
*Builder focuses on constructing a complex object step by step. [http://en.wikipedia.org/wiki/Abstract_factory_pattern Abstract Factory] emphasizes a family of product objects (either simple or complex). Builder returns the product as a final step, but as far as the Abstract Factory is concerned, the product gets returned immediately.&lt;br /&gt;
*Builder often builds a Composite.&lt;br /&gt;
*Often, designs start out using Factory Method (less complicated, more customizable, subclasses proliferate) and evolve toward Abstract Factory, Prototype, or Builder (more flexible, more complex) as the designer discovers where more flexibility is needed.&lt;br /&gt;
*Sometimes creational patterns are complementary: Builder can use one of the other patterns to implement which components are built. Abstract Factory, Builder, and Prototype can useSingleton in their implementations.&lt;br /&gt;
*Builders are good candidates for a fluent interface.&lt;br /&gt;
&lt;br /&gt;
==Difference between Builder Pattern and Factory Pattern==&lt;br /&gt;
The most common confusion in Design Patterns is the distinction between Builder and Factory Pattern. The most crucial points of difference can be found at the following sites:&lt;br /&gt;
&lt;br /&gt;
==Video Tutorials==&lt;br /&gt;
&lt;br /&gt;
The video tutorials listed here carry explanations along with code implementations:-&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=jstef_eUM6E&lt;br /&gt;
&lt;br /&gt;
*This 9 minute video tutorial by questpond.com is a conceptual explanation of the Builder Pattern with the help of 2 real life examples of tea preparation and one of generating reports. The video also illustrates a detailed Java implementation of the report generation system. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=9XnsOpjclUg&lt;br /&gt;
&lt;br /&gt;
*This 13 minute video tutorial by newthinktank.com illustrates a full fledged implementation of a Robot building system using the Builder Pattern.&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=1xo_sVKcHbY&lt;br /&gt;
&lt;br /&gt;
*This 9 minute video tutorial by zaneacademy gives a thorough explaantion of the key idea behind the Builder Pattern and its basic characteristics. It then goes on to explain the UML diagram of the Builder Pattern with an example. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=L-iKVzW56mY&amp;amp;playnext=1&amp;amp;list=PL39AB9FE0F96FADA5&amp;amp;feature=results_video&lt;br /&gt;
&lt;br /&gt;
*This 9 minute video tutorial by questpond.com about the implementation of the Builder Pattern in Java. We see an in-depth analysis of a car building system and how the builder pattern is used in its implementation. The video contains a complete code run of the example and the various methods used. &lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=S9p_mwz1dd4&lt;br /&gt;
&lt;br /&gt;
*The study of design patterns is complete only when one can differentiate between the various patterns This 12 minute video&lt;br /&gt;
&lt;br /&gt;
==Online Discussions==&lt;br /&gt;
These are some interesting online discussions on various issues related to the Builder Pattern&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/5211039/real-world-examples-of-the-builder-pattern&lt;br /&gt;
&lt;br /&gt;
*In this discussion on stackoverflow, the members are citing some personal coding experiences where the used the Builder Pattern and how. &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/328496/when-would-you-use-the-builder-pattern?lq=1&lt;br /&gt;
&lt;br /&gt;
*In this discussion on stackoverflow, the members are discussing various situations where the Builder Pattern scores over the Factory pattern, the Telescoping Constructor pattern and the JavaBean pattern. The differences between the patterns become clearer through this discussion. What is even more useful is that one of the participants of the discussion has also posted an implementation to highlight the difference. &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4737836/can-the-builder-pattern-ever-be-doing-too-much?rq=1&lt;br /&gt;
&lt;br /&gt;
*This is an interesting discussion where members discuss how the builder pattern trades off against the factory pattern not just conceptually but in actual practice. This discussion gives hints at choosing the best design pattern for a situation and what questions one must ask oneself before finalising the design pattern. &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/5674513/differences-between-builder-pattern-vs-template-method?rq=1&lt;br /&gt;
&lt;br /&gt;
*This discussion on stackoverflow.com is about the difference between the builder pattern and the template pattern. It also highlights the crucial distinctions between other patterns as well. &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/10941464/builder-pattern-with-inheritance?rq=1&lt;br /&gt;
&lt;br /&gt;
*This is an interesting discussion of using the Builder Pattern in an inheritance hierarchy. &lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/7302891/the-builder-pattern-and-a-large-number-of-mandatory-parameters?rq=1&lt;br /&gt;
&lt;br /&gt;
*This discussion on stackoverflow focusses on the general good practices that can be used while implementing the Builder pattern. Which secondary design decisions are helpful and which could raise problems during implementation. The members are each giving their own implementation practices and how they trade off when compared to other conventions followed while implementing the Builder pattern.&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=67038</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=67038"/>
		<updated>2012-10-04T01:20:34Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides [http://www.debian.org/doc/manuals/intro-i18n/ i18n] language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. &lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for [http://en.wikipedia.org/wiki/Ruby_on_Rails Rails] applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor [http://dannorth.net/2007/06/17/introducing-rbehave/ RBehave] required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''On Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature &lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
===='''Given/When/Then + And/But construct'''====&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre-conditions of [http://en.wikipedia.org/wiki/Use_case Usecase]. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
The advantages of Cucumber are that it mandates a person to spend more time in the planning phase before directly getting into the complexities of models, views and controllers. It lets one have a broader perspective of the application one intends to develop.&lt;br /&gt;
The syntax which is in simple English is what makes it unique letting clients who are not aware of the technicalities of a system, voice their opinion in the development process and hence the development is always in sync with the requirement.&lt;br /&gt;
&lt;br /&gt;
=='''Ongoing developments'''==&lt;br /&gt;
Cucumber has rapidly become one of the most preferred tools for automated testing. Aslak Hellesoy and his team are working on further advancements and improvements to the tool. Improving the documentation via the [http://pragprog.com/book/hwcuc/the-cucumber-book &amp;quot;The Cucumber Book&amp;quot;] being one of them. The book continues to be revised to keep up with its rapid evolution. Currently, Cucumber tests run on JVMs through JRuby. But to overcome the inherent latency, the team is working on a native Java implementation of the tool which can be built in to the Java development environment. During this adaptation to Java, the team also found aspects of the Ruby implementation that could be improved to make it much more flexible.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Further reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=67015</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=67015"/>
		<updated>2012-10-04T01:15:19Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides [http://www.debian.org/doc/manuals/intro-i18n/ i18n] language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. &lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for [http://en.wikipedia.org/wiki/Ruby_on_Rails Rails] applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor [http://dannorth.net/2007/06/17/introducing-rbehave/ RBehave] required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''On Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature &lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
===='''Given/When/Then + And/But construct'''====&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre-conditions of [http://en.wikipedia.org/wiki/Use_case Usecase]. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
The advantages of Cucumber are that it mandates a person to spend more time in the planning phase before directly getting into the complexities of models, views and controllers. It lets one have a broader perspective of the application one intends to develop.&lt;br /&gt;
The syntax which is in simple English is what makes it unique letting clients who are not aware of the technicalities of a system, voice their opinion in the development process and hence the development is always in sync with the requirement.&lt;br /&gt;
&lt;br /&gt;
=='''Ongoing developments'''==&lt;br /&gt;
Cucumber has rapidly become one of the most preferred tools for automated testing. Aslak Hellesoy and his team are working on further advancements and improvements to the tool. Improving the documentation on the tool via the [http://pragprog.com/book/hwcuc/the-cucumber-book &amp;quot;The Cucumber Book&amp;quot;] being one of them. The book continues to be revised to keep up with the rapidly evolving tool. Currently, Cucumber tests run on JVMs through JRuby. But to overcome the inherent latency, the team is working on a native Java implementation of the tool which can be built in to the Java development environment. During this adaptation to Java, the team also found aspects of the Ruby implementation that could be improved to make it much more flexible.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Further reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=67005</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=67005"/>
		<updated>2012-10-04T01:12:53Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides [http://www.debian.org/doc/manuals/intro-i18n/ i18n] language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. &lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for [http://en.wikipedia.org/wiki/Ruby_on_Rails Rails] applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''On Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature &lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
===='''Given/When/Then + And/But construct'''====&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre-conditions of [http://en.wikipedia.org/wiki/Use_case Usecase]. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
The advantages of Cucumber are that it mandates a person to spend more time in the planning phase before directly getting into the complexities of models, views and controllers. It lets one have a broader perspective of the application one intends to develop.&lt;br /&gt;
The syntax which is in simple English is what makes it unique letting clients who are not aware of the technicalities of a system, voice their opinion in the development process and hence the development is always in sync with the requirement.&lt;br /&gt;
&lt;br /&gt;
=='''Ongoing developments'''==&lt;br /&gt;
Cucumber has rapidly become one of the most preferred tools for automated testing. Aslak Hellesoy and his team are working on further advancements and improvements to the tool. Improving the documentation on the tool via the [http://pragprog.com/book/hwcuc/the-cucumber-book &amp;quot;The Cucumber Book&amp;quot;] being one of them. The book continues to be revised to keep up with the rapidly evolving tool. Currently, Cucumber tests run on JVMs through JRuby. But to overcome the inherent latency, the team is working on a native Java implementation of the tool which can be built in to the Java development environment. During this adaptation to Java, the team also found aspects of the Ruby implementation that could be improved to make it much more flexible.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Further reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66995</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66995"/>
		<updated>2012-10-04T01:11:19Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides [http://www.debian.org/doc/manuals/intro-i18n/ i18n] language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. &lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''On Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature &lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
===='''Given/When/Then + And/But construct'''====&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre-conditions of [http://en.wikipedia.org/wiki/Use_case Usecase]. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
The advantages of Cucumber are that it mandates a person to spend more time in the planning phase before directly getting into the complexities of models, views and controllers. It lets one have a broader perspective of the application one intends to develop.&lt;br /&gt;
The syntax which is in simple English is what makes it unique letting clients who are not aware of the technicalities of a system, voice their opinion in the development process and hence the development is always in sync with the requirement.&lt;br /&gt;
&lt;br /&gt;
=='''Ongoing developments'''==&lt;br /&gt;
Cucumber has rapidly become one of the most preferred tools for automated testing. Aslak Hellesoy and his team are working on further advancements and improvements to the tool. Improving the documentation on the tool via the [http://pragprog.com/book/hwcuc/the-cucumber-book &amp;quot;The Cucumber Book&amp;quot;] being one of them. The book continues to be revised to keep up with the rapidly evolving tool. Currently, Cucumber tests run on JVMs through JRuby. But to overcome the inherent latency, the team is working on a native Java implementation of the tool which can be built in to the Java development environment. During this adaptation to Java, the team also found aspects of the Ruby implementation that could be improved to make it much more flexible.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Further reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66975</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66975"/>
		<updated>2012-10-04T01:05:08Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''On Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature &lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
===='''Given/When/Then + And/But construct'''====&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
The advantages of Cucumber are that it mandates a person to spend more time in the planning phase before directly getting into the complexities of models, views and controllers. It lets one have a broader perspective of the application one intends to develop.&lt;br /&gt;
The syntax which is in simple English is what makes it unique letting clients who are not aware of the technicalities of a system, voice their opinion in the development process and hence the development is always in sync with the requirement.&lt;br /&gt;
&lt;br /&gt;
=='''Ongoing developments'''==&lt;br /&gt;
Cucumber has rapidly become one of the most preferred tools for automated testing. Aslak Hellesoy and his team are working on further advancements and improvements to the tool. Improving the documentation on the tool via the [http://pragprog.com/book/hwcuc/the-cucumber-book &amp;quot;The Cucumber Book&amp;quot;] being one of them. The book continues to be revised to keep up with the rapidly evolving tool. Currently, Cucumber tests run on JVMs through JRuby. But to overcome the inherent latency, the team is working on a native Java implementation of the tool which can be built in to the Java development environment. During this adaptation to Java, the team also found aspects of the Ruby implementation that could be improved to make it much more flexible.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Further reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66933</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66933"/>
		<updated>2012-10-04T00:54:16Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction'''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''On Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature &lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
===='''Given/When/Then + And/But construct'''====&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
The advantages of Cucumber are that it mandates a person to spend more time in the planning phase before directly getting into the complexities of models, views and controllers. It lets one have a broader perspective of the application one intends to develop.&lt;br /&gt;
The syntax which is in simple English is what makes it unique letting clients who are not aware of the technicalities of a system, voice their opinion in the development process and hence the development is always in sync with the requirement.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Further reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66923</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66923"/>
		<updated>2012-10-04T00:51:30Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''On Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature &lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
===='''Given/When/Then + And/But construct'''====&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
The advantages of Cucumber are that it mandates a person to spend more time in the planning phase before directly getting into the complexities of models, views and controllers. It lets one have a broader perspective of the application one intends to develop.&lt;br /&gt;
The syntax which is in simple English is what makes it unique letting clients who are not aware of the technicalities of a system, voice their opinion in the development process and hence the development is always in sync with the requirement.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66919</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66919"/>
		<updated>2012-10-04T00:50:28Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''On Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature steps&lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
==='''Given/When/Then + And/But construct'''===&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
The advantages of Cucumber are that it mandates a person to spend more time in the planning phase before directly getting into the complexities of models, views and controllers. It lets one have a broader perspective of the application one intends to develop.&lt;br /&gt;
The syntax which is in simple English is what makes it unique letting clients who are not aware of the technicalities of a system, voice their opinion in the development process and hence the development is always in sync with the requirement.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66898</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66898"/>
		<updated>2012-10-04T00:41:53Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''Steps for Installation of Cucumber for Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature steps&lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
==='''Given/When/Then + And/But construct'''===&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
The advantages of Cucumber are that it mandates a person to spend more time in the planning phase before directly getting into the complexities of models, views and controllers. It lets one have a broader perspective of the application one intends to develop.&lt;br /&gt;
The syntax which is in simple English is what makes it unique letting clients who are not aware of the technicalities of a system, voice their opinion in the development process and hence the development is always in sync with the requirement.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66894</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66894"/>
		<updated>2012-10-04T00:40:55Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''Steps for Installation of Cucumber for Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature steps&lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
==='''Given/When/Then + And/But construct'''===&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
The advantages of Cucumber are that it mandates a person to spend more time in the planning phase before directly getting into the complexities of models, views and controllers. It lets one have a broader perspective of the application one intends to develop.&lt;br /&gt;
The syntax which is in simple english is what makes it unique letting clients who are not aware of the technicalities of a sytem, voice their opinion in the development process and hence the development is always in synch with the requirement.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66873</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66873"/>
		<updated>2012-10-04T00:35:07Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''Steps for Installation of Cucumber for Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber testing comprises of two components namely &lt;br /&gt;
*Feature steps&lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
==='''Given/When/Then + And/But construct'''===&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
Cucumber was developed in order to involve clients and stakeholders in the development process. We could be dealing with people who may not be technically minded or whose experience of the web may only be lolcats. As great as that may be, asking them to imagine filling out a couple of forms online before making sure we are meeting their requirements is a bit much&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66871</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66871"/>
		<updated>2012-10-04T00:34:08Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''Steps for Installation of Cucumber for Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of two components namely &lt;br /&gt;
*Feature steps&lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
==='''Given/When/Then + And/But construct'''===&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
Cucumber was developed in order to involve clients and stakeholders in the development process. We could be dealing with people who may not be technically minded or whose experience of the web may only be lolcats. As great as that may be, asking them to imagine filling out a couple of forms online before making sure we are meeting their requirements is a bit much&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66868</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66868"/>
		<updated>2012-10-04T00:33:28Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''Steps for Installation of Cucumber for Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of two components namely &lt;br /&gt;
*Feature steps&lt;br /&gt;
*Step Definitions&lt;br /&gt;
&lt;br /&gt;
==='''Features'''===&lt;br /&gt;
Features are essentially outward facing in the sense that they describe the ideal outcome given a state of the system. A given state of the system is the cumulative input to the system comprising of the events taking place in the given context and the predefined variables. Each feature is a collection of scenarios. The scenarios each are described by the given/when/then + and/but construct. Features are also known as '''matcher''' methods and are integral link to the step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. &lt;br /&gt;
&lt;br /&gt;
=== Given/When/Then + And/But construct&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  &lt;br /&gt;
Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
&lt;br /&gt;
'''When''': &lt;br /&gt;
This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
&lt;br /&gt;
'''Then''': &lt;br /&gt;
This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
&lt;br /&gt;
'''And/But''':  &lt;br /&gt;
These are used when there are multiple given conditions for which some actions need to be performed. &lt;br /&gt;
&lt;br /&gt;
An Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
==='''Step Definitions'''===&lt;br /&gt;
Step definitions are primarily inward facing as they map the outward facing scenario statements with the inner Ruby code snippets. Step definitions either consists of keyword, string or regular expression. The mapping is mostly done by expression matching and calling the appropriate code snippets in the Ruby code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
Cucumber was developed in order to involve clients and stakeholders in the development process. We could be dealing with people who may not be technically minded or whose experience of the web may only be lolcats. As great as that may be, asking them to imagine filling out a couple of forms online before making sure we are meeting their requirements is a bit much&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66841</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66841"/>
		<updated>2012-10-04T00:23:33Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: /* Advantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''Steps for Installation of Cucumber for Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of 3 components namely &lt;br /&gt;
*Feature&lt;br /&gt;
*Scenario&lt;br /&gt;
*implementation &lt;br /&gt;
&lt;br /&gt;
'''Features''': &lt;br /&gt;
It is a collection of scenarios written in Gherkin. Scenarios basically start with the keyword “Scenarios” and each having keywords like Given/When/Then/And or But. These are also known as matcher methods and are an integral part of the step definitions popularly known as step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. Step definitions either consists of keyword, string or regular expression.&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
'''When''': This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
'''Then''': This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
'''And/But''':  These are used when there are multiple given conditions for which some actions need to be performed. Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
Since most of the time the clients are people who are not from a technical background, Cucumber gives the flexibility to the stakeholders to voice their opinion in the development process and specify the pre-requisites of a system in simple language without getting into the technicalities of the system.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66835</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66835"/>
		<updated>2012-10-04T00:21:17Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: /* Advantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''Steps for Installation of Cucumber for Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of 3 components namely &lt;br /&gt;
*Feature&lt;br /&gt;
*Scenario&lt;br /&gt;
*implementation &lt;br /&gt;
&lt;br /&gt;
'''Features''': &lt;br /&gt;
It is a collection of scenarios written in Gherkin. Scenarios basically start with the keyword “Scenarios” and each having keywords like Given/When/Then/And or But. These are also known as matcher methods and are an integral part of the step definitions popularly known as step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. Step definitions either consists of keyword, string or regular expression.&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
'''When''': This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
'''Then''': This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
'''And/But''':  These are used when there are multiple given conditions for which some actions need to be performed. Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
Cucumber was developed so that the stakeholders could voice their opinion in the development process.Cucumber gives the flexibility to the stakeholders to be a part of the system development and specify the pre-requisites of a system in simple language without getting into the technicalities of the system.&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66818</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66818"/>
		<updated>2012-10-04T00:11:06Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. With the libraries and drivers provided by Capybara for deploying web applications and for interacting with service applications, the testing requires minimum amount of coding.&lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''Steps for Installation of Cucumber for Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of 3 components namely &lt;br /&gt;
*Feature&lt;br /&gt;
*Scenario&lt;br /&gt;
*implementation &lt;br /&gt;
&lt;br /&gt;
'''Features''': &lt;br /&gt;
It is a collection of scenarios written in Gherkin. Scenarios basically start with the keyword “Scenarios” and each having keywords like Given/When/Then/And or But. These are also known as matcher methods and are an integral part of the step definitions popularly known as step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. Step definitions either consists of keyword, string or regular expression.&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
'''When''': This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
'''Then''': This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
'''And/But''':  These are used when there are multiple given conditions for which some actions need to be performed. Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
Cucumber was developed in order to involve clients and stakeholders in the development process. We could be dealing with people who may not be technically minded or whose experience of the web may only be lolcats. As great as that may be, asking them to imagine filling out a couple of forms online before making sure we are meeting their requirements is a bit much&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66806</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66806"/>
		<updated>2012-10-04T00:06:33Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''Steps for Installation of Cucumber for Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of 3 components namely &lt;br /&gt;
*Feature&lt;br /&gt;
*Scenario&lt;br /&gt;
*implementation &lt;br /&gt;
&lt;br /&gt;
'''Features''': &lt;br /&gt;
It is a collection of scenarios written in Gherkin. Scenarios basically start with the keyword “Scenarios” and each having keywords like Given/When/Then/And or But. These are also known as matcher methods and are an integral part of the step definitions popularly known as step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. Step definitions either consists of keyword, string or regular expression.&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
'''When''': This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
'''Then''': This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
'''And/But''':  These are used when there are multiple given conditions for which some actions need to be performed. Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''Advantages'''==&lt;br /&gt;
Cucumber was developed in order to involve clients and stakeholders in the development process. We could be dealing with people who may not be technically minded or whose experience of the web may only be lolcats. As great as that may be, asking them to imagine filling out a couple of forms online before making sure we are meeting their requirements is a bit much&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66796</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66796"/>
		<updated>2012-10-04T00:03:58Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
==='''Generic installation'''===&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
==='''Steps for Installation of Cucumber for Ruby on Rails 3.x'''===&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of 3 components namely &lt;br /&gt;
*Feature&lt;br /&gt;
*Scenario&lt;br /&gt;
*implementation &lt;br /&gt;
&lt;br /&gt;
'''Features''': &lt;br /&gt;
It is a collection of scenarios written in Gherkin. Scenarios basically start with the keyword “Scenarios” and each having keywords like Given/When/Then/And or But. These are also known as matcher methods and are an integral part of the step definitions popularly known as step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. Step definitions either consists of keyword, string or regular expression.&lt;br /&gt;
&lt;br /&gt;
'''Given''' :  Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
'''When''': This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
'''Then''': This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
'''And/But''':  These are used when there are multiple given conditions for which some actions need to be performed. Example:&lt;br /&gt;
&lt;br /&gt;
   Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66785</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66785"/>
		<updated>2012-10-04T00:00:08Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support [http://en.wikipedia.org/wiki/Behavior-driven_development Behavior Driven Development(BDD)] which is derived from [http://en.wikipedia.org/wiki/Test-driven_development Test Driven Development]. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as [http://en.wikipedia.org/wiki/JRuby JRuby], alternative application frameworks such as [http://www.sinatrarb.com/ Sinatra], other programming languages such as [http://www.python.org Python], test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and [http://seleniumhq.org/projects/ide/ Selenium]. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of [http://rspec.info/ RSpec]'s &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glitches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contributing to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of 3 components namely &lt;br /&gt;
*Feature&lt;br /&gt;
*Scenario&lt;br /&gt;
*implementation &lt;br /&gt;
&lt;br /&gt;
Features: &lt;br /&gt;
It is a collection of scenarios written in Gherkin. Scenarios basically start with the keyword “Scenarios” and each having keywords like Given/When/Then/And or But. These are also known as matcher methods and are an integral part of the step definitions popularly known as step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. Step definitions either consists of keyword, string or regular expression.&lt;br /&gt;
&lt;br /&gt;
Given :  Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
When: This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
Then: This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
And/But:  These are used when there are multiple given conditions for which some actions need to be performed.&lt;br /&gt;
   Eg: Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
Implementations are generally steps written in Ruby for realizing the features. Each scenario has its equivalent block of Ruby Code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;br /&gt;
*http://jimmyzimmerman.com/blog/2008/05/intro-to-story-runner-and-bdd.html&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66776</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66776"/>
		<updated>2012-10-03T23:54:58Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin '''Gherkin'''], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of 3 components namely &lt;br /&gt;
*Feature&lt;br /&gt;
*Scenario&lt;br /&gt;
*implementation &lt;br /&gt;
&lt;br /&gt;
Features: &lt;br /&gt;
It is a collection of scenarios written in Gherkin. Scenarios basically start with the keyword “Scenarios” and each having keywords like Given/When/Then/And or But. These are also known as matcher methods and are an integral part of the step definitions popularly known as step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. Step definitions either consists of keyword, string or regular expression.&lt;br /&gt;
&lt;br /&gt;
Given :  Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
When: This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
Then: This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
And/But:  These are used when there are multiple given conditions for which some actions need to be performed.&lt;br /&gt;
   Eg: Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
Implementations are generally steps written in Ruby for realizing the features. Each scenario has its equivalent block of Ruby Code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66774</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66774"/>
		<updated>2012-10-03T23:53:22Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin Gherkin], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of 3 components namely &lt;br /&gt;
*Feature&lt;br /&gt;
*Scenario&lt;br /&gt;
*implementation &lt;br /&gt;
&lt;br /&gt;
Features: &lt;br /&gt;
It is a collection of scenarios written in Gherkin. Scenarios basically start with the keyword “Scenarios” and each having keywords like Given/When/Then/And or But. These are also known as matcher methods and are an integral part of the step definitions popularly known as step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. Step definitions either consists of keyword, string or regular expression.&lt;br /&gt;
&lt;br /&gt;
Given :  Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
When: This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
Then: This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
And/But:  These are used when there are multiple given conditions for which some actions need to be performed.&lt;br /&gt;
   Eg: Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
Implementations are generally steps written in Ruby for realizing the features. Each scenario has its equivalent block of Ruby Code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66767</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66767"/>
		<updated>2012-10-03T23:50:00Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin Gherkin], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
Cucumber comprises of 3 components namely &lt;br /&gt;
*Feature&lt;br /&gt;
*Scenario&lt;br /&gt;
*implementation &lt;br /&gt;
&lt;br /&gt;
Features: &lt;br /&gt;
It is a collection of scenarios written in Gherkin. Scenarios basically start with the keyword “Scenarios” and each having keywords like Given/When/Then/And or But. These are also known as matcher methods and are an integral part of the step definitions popularly known as step definitions. Now when Cucumber is executed the corresponding block of Ruby code is invoked. Scenarios are independent of each other and once a scenario execution is over there is nothing which is carried over to the next scenario. Step definitions either consists of keyword, string or regular expression.&lt;br /&gt;
&lt;br /&gt;
Given :  Purpose of given is to create a setting for user interaction with the system. These are analogous to the pre conditions of usecase. &lt;br /&gt;
When: This for the main actions the user performs ‘given’ a scenario i.e. transition of state which has an observable effect.&lt;br /&gt;
Then: This is majorly to check the consequences of the action performed by the user i.e. what is the output of the system when a particular input is given.&lt;br /&gt;
And/But:  These are used when there are multiple given conditions for which some actions need to be performed.&lt;br /&gt;
   Eg: Scenario: Manifold Givens&lt;br /&gt;
   Given the username&lt;br /&gt;
   And Given the password&lt;br /&gt;
   When I press enter&lt;br /&gt;
   Then I see the username on the screen&lt;br /&gt;
   But I do not see the password on the screen&lt;br /&gt;
&lt;br /&gt;
Implementations are generally steps written in Ruby for realizing the features. Each scenario has its equivalent block of Ruby Code.&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
[ref/]&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66761</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66761"/>
		<updated>2012-10-03T23:47:45Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin Gherkin], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
[ref/]&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66759</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66759"/>
		<updated>2012-10-03T23:47:13Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is &amp;lt;ref&amp;gt;[https://github.com/cucumber/cucumber/wiki/Gherkin] Gherkin&amp;lt;/ref&amp;gt;, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
[ref/]&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66755</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66755"/>
		<updated>2012-10-03T23:46:31Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is &amp;lt;ref&amp;gt;[https://github.com/cucumber/cucumber/wiki/Gherkin Gherkin]&amp;lt;/ref&amp;gt;, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
[references/]&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66753</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66753"/>
		<updated>2012-10-03T23:46:12Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is &amp;lt;ref&amp;gt;[https://github.com/cucumber/cucumber/wiki/Gherkin Gherkin]&amp;lt;ref&amp;gt;, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66743</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66743"/>
		<updated>2012-10-03T23:43:37Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin Gherkin], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66741</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66741"/>
		<updated>2012-10-03T23:43:07Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable [http://en.wikipedia.org/wiki/Domain-specific_language domain-specific language(DSL)], most widely used is [https://github.com/cucumber/cucumber/wiki/Gherkin Gherkin], although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
[references/]&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''==&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66723</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66723"/>
		<updated>2012-10-03T23:37:47Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL), most widely used is Gherkin, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
*http://cukes.info/&lt;br /&gt;
*http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html&lt;br /&gt;
*http://www.allenwei.cn/cucumber-capybara-what-we-need-for-rails-integration-test/&lt;br /&gt;
*http://railscasts.com/episodes/155-beginning-with-cucumber&lt;br /&gt;
*http://rubysource.com/smelly-cucumbers/&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''===&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66715</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66715"/>
		<updated>2012-10-03T23:34:56Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL), most widely used is Gherkin, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''===&lt;br /&gt;
*http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66713</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66713"/>
		<updated>2012-10-03T23:34:05Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL), most widely used is Gherkin, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
'''Features and Scenarios''': As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
'''Step Definitions''': As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
'''Class definition''': This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''===&lt;br /&gt;
http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66711</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66711"/>
		<updated>2012-10-03T23:33:08Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
=='''Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL), most widely used is Gherkin, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
=='''History and the need for development'''==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Cucumber'''==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
Features and Scenarios: As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions: As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class definition: This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''===&lt;br /&gt;
http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66704</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66704"/>
		<updated>2012-10-03T23:31:57Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
==''' Introduction '''==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL), most widely used is Gherkin, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
== '''History and the need for development''' ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
== '''Setting up Cucumber''' ==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
=='''Gherkin - the language Cucumber understands'''==&lt;br /&gt;
&lt;br /&gt;
=='''How Cucumber works''' ==&lt;br /&gt;
&lt;br /&gt;
=='''Setting up Capybara''' ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
=='''Example of running Cucumber tests on Capybara'''==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
Features and Scenarios: As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions: As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class definition: This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
=='''Suggested Further Reading'''===&lt;br /&gt;
http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66681</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66681"/>
		<updated>2012-10-03T23:25:28Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL), most widely used is Gherkin, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
== History and the need for development ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
== Setting up Cucumber ==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
== Gherkin - the language Cucumber understands ==&lt;br /&gt;
&lt;br /&gt;
== How Cucumber works ==&lt;br /&gt;
&lt;br /&gt;
== Setting up Capybara ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
== Example of running Cucumber tests on Capybara ==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
Features and Scenarios: As discussed above, the features ... In the example below, the feature describes a scenario within a banking system where a student needs to test the system's ability to find the simple interest on a given principal at a given rate per year.  &lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principal&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions: As discussed before, the step definitions provided the mapping for the corresponding code snippets that each scenario within the feature interacts with. In this example, for the givens, we first create an object of the class Interest_calc and push the arguments into the instance. Then for when, we call the corresponding method that calculates the interest. For the then, we display the result on the screen.&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class definition: This is the Interest_calc class that is accessed in the step definition.&lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66661</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66661"/>
		<updated>2012-10-03T23:15:20Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL), most widely used is Gherkin, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
== History and the need for development ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
== Setting up Cucumber ==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
== Gherkin - the language Cucumber understands ==&lt;br /&gt;
&lt;br /&gt;
== How Cucumber works ==&lt;br /&gt;
&lt;br /&gt;
== Setting up Capybara ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
== Example of running Cucumber tests on Capybara ==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. It is also possible to use the Capybara DSL for writing the tests but the most widely used DSL is Gherkin. The example below uses Gherkin but it can be easily transformed using the DSL provided by Capybara.&lt;br /&gt;
&lt;br /&gt;
Features and Scenarios:&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class definition: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66635</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66635"/>
		<updated>2012-10-03T22:58:46Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL), most widely used is Gherkin, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
== History and the need for development ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
== Setting up Cucumber ==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
== Gherkin - the language Cucumber understands ==&lt;br /&gt;
&lt;br /&gt;
== How Cucumber works ==&lt;br /&gt;
&lt;br /&gt;
== Setting up Capybara ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
== Example of running Cucumber tests on Capybara ==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. &lt;br /&gt;
&lt;br /&gt;
Features and Scenarios:&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class definition: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66630</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66630"/>
		<updated>2012-10-03T22:55:59Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL), most widely used is Gherkin, although you can use testing environment specific languages also like the Capbara DSL&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment. It carries all the information about the driver running the test and comes with a built in support for Rack::Test and Selenium. It requires no explicit setting up&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' is a testing environment that simulates the manner in which a real world user would interact with the application. It requires no explicit setup for Rails applications. The most powerful feature of Capybara is that it has a very intuitive application program interface that understands any language an actual user would use. &lt;br /&gt;
&lt;br /&gt;
== History and the need for development ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
== Setting up Cucumber ==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
== Gherkin - the language Cucumber understands ==&lt;br /&gt;
&lt;br /&gt;
== Cucumber &amp;quot;Features&amp;quot; and &amp;quot;Scenarios&amp;quot; == &lt;br /&gt;
&lt;br /&gt;
== Cucumber &amp;quot;Step Definitions&amp;quot; == &lt;br /&gt;
&lt;br /&gt;
== Setting up Capybara ==&lt;br /&gt;
As explained before, Capybara doesn't require explict set up for Rails applications.&lt;br /&gt;
For Rails, we add the following line to the test helper file: &lt;br /&gt;
 require 'capybara/rails'&lt;br /&gt;
&lt;br /&gt;
== Example of running Cucumber tests on Capybara ==&lt;br /&gt;
After setting up cucumber-rails and Capybara as described above, the following example describes how an actual cucumber test is written and run in the Capybara environment. &lt;br /&gt;
&lt;br /&gt;
Features and Scenarios:&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    require 'capybara/cucumber'&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class definition: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66603</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66603"/>
		<updated>2012-10-03T22:41:29Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' &lt;br /&gt;
&lt;br /&gt;
== History and the need for development ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
== Setting up Cucumber ==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
== Gherkin - the language Cucumber understands ==&lt;br /&gt;
&lt;br /&gt;
== Cucumber &amp;quot;Features&amp;quot; and &amp;quot;Scenarios&amp;quot; == &lt;br /&gt;
&lt;br /&gt;
== Cucumber &amp;quot;Step Definitions&amp;quot; == &lt;br /&gt;
&lt;br /&gt;
== Setting up Capybara ==&lt;br /&gt;
&lt;br /&gt;
== Example of running Cucumber tests on Capybara ==&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    begin require 'rpec/expectations';&lt;br /&gt;
    rescue LoadError;&lt;br /&gt;
    require 'spec/expectations';&lt;br /&gt;
    end&lt;br /&gt;
    require 'cucumber/formatter/unicode'&lt;br /&gt;
    $:.unshift(File.dirname(_FILE_) + '/../../lib')&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class def: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66584</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66584"/>
		<updated>2012-10-03T22:34:24Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' &lt;br /&gt;
&lt;br /&gt;
== History and the need for development ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
== Setting up Cucumber ==&lt;br /&gt;
[['''Generic installation''']]&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
[['''Steps for Installation of Cucumber for Ruby on Rails 3.x''']]&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    begin require 'rpec/expectations';&lt;br /&gt;
    rescue LoadError;&lt;br /&gt;
    require 'spec/expectations';&lt;br /&gt;
    end&lt;br /&gt;
    require 'cucumber/formatter/unicode'&lt;br /&gt;
    $:.unshift(File.dirname(_FILE_) + '/../../lib')&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class def: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66572</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66572"/>
		<updated>2012-10-03T22:31:23Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' &lt;br /&gt;
&lt;br /&gt;
== History and the need for development ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
== Setting up Cucumber ==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    begin require 'rpec/expectations';&lt;br /&gt;
    rescue LoadError;&lt;br /&gt;
    require 'spec/expectations';&lt;br /&gt;
    end&lt;br /&gt;
    require 'cucumber/formatter/unicode'&lt;br /&gt;
    $:.unshift(File.dirname(_FILE_) + '/../../lib')&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class def: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66571</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66571"/>
		<updated>2012-10-03T22:30:47Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
'''Cucumber''' is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment&lt;br /&gt;
&lt;br /&gt;
'''Capybara''' &lt;br /&gt;
&lt;br /&gt;
== History and the need for development ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
== Setting up Cucumber ==&lt;br /&gt;
'''Generic installation'''&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
'''Steps for Installation of Cucumber for Ruby on Rails 3.x'''&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    begin require 'rpec/expectations';&lt;br /&gt;
    rescue LoadError;&lt;br /&gt;
    require 'spec/expectations';&lt;br /&gt;
    end&lt;br /&gt;
    require 'cucumber/formatter/unicode'&lt;br /&gt;
    $:.unshift(File.dirname(_FILE_) + '/../../lib')&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class def: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66568</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66568"/>
		<updated>2012-10-03T22:29:17Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Cucumber is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
Cucumber provides support for a wide range of Ruby virtual machines such as JRuby, alternative application frameworks such as Sinatra, other programming languages such as Python, test environments such as Capybara and provides i18n language support for feature and step files. &lt;br /&gt;
&lt;br /&gt;
This article primarily focuses on running Cucumber tests on the Capybara testing environment&lt;br /&gt;
&lt;br /&gt;
Capybara &lt;br /&gt;
&lt;br /&gt;
== History and the need for development ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
&lt;br /&gt;
== Setting up Cucumber ==&lt;br /&gt;
&lt;br /&gt;
Install Ruby on the system &lt;br /&gt;
&lt;br /&gt;
 gem install cucumber&lt;br /&gt;
&lt;br /&gt;
To read up on more information about this gem&lt;br /&gt;
&lt;br /&gt;
 cucumber --help&lt;br /&gt;
&lt;br /&gt;
Steps for Installation of Cucumber for Ruby on Rails 3.x&lt;br /&gt;
Cucumber-Rails is used for performing Cucumber tests on Rails.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Add the following to the Gem File&lt;br /&gt;
 &lt;br /&gt;
 group :test do&lt;br /&gt;
  gem 'cucumber-rails', :require =&amp;gt; false&lt;br /&gt;
  # database_cleaner is not required, but highly recommended&lt;br /&gt;
  gem 'database_cleaner'&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Step 2 : Then install the gem &lt;br /&gt;
 &lt;br /&gt;
 bundle install&lt;br /&gt;
&lt;br /&gt;
Step 3 : Bootstrap your Rails app by&lt;br /&gt;
&lt;br /&gt;
 rails generate cucumber:install&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    begin require 'rpec/expectations';&lt;br /&gt;
    rescue LoadError;&lt;br /&gt;
    require 'spec/expectations';&lt;br /&gt;
    end&lt;br /&gt;
    require 'cucumber/formatter/unicode'&lt;br /&gt;
    $:.unshift(File.dirname(_FILE_) + '/../../lib')&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class def: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66540</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66540"/>
		<updated>2012-10-03T22:08:52Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Cucumber is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD) which is derived from Test Driven Development. This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
== History and the need for development ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby, it can be used to test code written in Ruby and other languages too. Not limited to Java, C# and Python. It required minimal use of Ruby and is hence believed to be extremely easy to code. Moreover, the user stories for the features can be written in any human language. &lt;br /&gt;
&lt;br /&gt;
Ever since, Cucumber has seen a lot of revision and refactoring. One of the major refactoring include transferring certain implementation portions to make it customized for particular frameworks&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    begin require 'rpec/expectations';&lt;br /&gt;
    rescue LoadError;&lt;br /&gt;
    require 'spec/expectations';&lt;br /&gt;
    end&lt;br /&gt;
    require 'cucumber/formatter/unicode'&lt;br /&gt;
    $:.unshift(File.dirname(_FILE_) + '/../../lib')&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class def: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66529</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66529"/>
		<updated>2012-10-03T21:49:43Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Cucumber is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD). This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
== Cucumber vs Previous Stories based Testing tools ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Story Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby,&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    begin require 'rpec/expectations';&lt;br /&gt;
    rescue LoadError;&lt;br /&gt;
    require 'spec/expectations';&lt;br /&gt;
    end&lt;br /&gt;
    require 'cucumber/formatter/unicode'&lt;br /&gt;
    $:.unshift(File.dirname(_FILE_) + '/../../lib')&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class def: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66527</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66527"/>
		<updated>2012-10-03T21:48:04Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Cucumber is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD). This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
== Cucumber vs Previous Stories based Testing tools ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Stroy Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
Though Cucumber is written in Ruby,&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    begin require 'rpec/expectations';&lt;br /&gt;
    rescue LoadError;&lt;br /&gt;
    require 'spec/expectations';&lt;br /&gt;
    end&lt;br /&gt;
    require 'cucumber/formatter/unicode'&lt;br /&gt;
    $:.unshift(File.dirname(_FILE_) + '/../../lib')&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class def: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66526</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66526"/>
		<updated>2012-10-03T21:45:42Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Cucumber is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD). This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
== Cucumber vs Previous Stories based Testing tools ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Stroy Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    begin require 'rpec/expectations';&lt;br /&gt;
    rescue LoadError;&lt;br /&gt;
    require 'spec/expectations';&lt;br /&gt;
    end&lt;br /&gt;
    require 'cucumber/formatter/unicode'&lt;br /&gt;
    $:.unshift(File.dirname(_FILE_) + '/../../lib')&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Class def: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66525</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66525"/>
		<updated>2012-10-03T21:44:38Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Cucumber is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD). This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
== Cucumber vs Previous Stories based Testing tools ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Stroy Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
 # Language: English&lt;br /&gt;
&lt;br /&gt;
 Feature: InterestCalc&lt;br /&gt;
 In order to avoid an error in interest calculation&lt;br /&gt;
 As a new student&lt;br /&gt;
 I want to be told the interest for given principal per year&lt;br /&gt;
&lt;br /&gt;
  Scenario: Interest on Principle&lt;br /&gt;
   * I have entered 1000 into the interest_calc&lt;br /&gt;
   * I have entered  3.5 into the interest_calc&lt;br /&gt;
   * I press calc&lt;br /&gt;
   * The result should 35 on the screen&lt;br /&gt;
&lt;br /&gt;
 Step Definitions:&lt;br /&gt;
&lt;br /&gt;
    begin require 'rpec/expectations';&lt;br /&gt;
    rescue LoadError;&lt;br /&gt;
    require 'spec/expectations';&lt;br /&gt;
    end&lt;br /&gt;
    require 'cucumber/formatter/unicode'&lt;br /&gt;
    $:.unshift(File.dirname(_FILE_) + '/../../lib')&lt;br /&gt;
    require 'Interest_calc'&lt;br /&gt;
&lt;br /&gt;
    Given /I have entered (.*) into the interest_calc/ do |n|&lt;br /&gt;
      @calci=Interest_calc.new&lt;br /&gt;
      @calci.setdata(n)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    When /I press (\w+)/ do |op|&lt;br /&gt;
      @result=@calci.calc&lt;br /&gt;
    end&lt;br /&gt;
 &lt;br /&gt;
    Then /the result should be (.*) on the screen/ do |result|&lt;br /&gt;
      @result.should == result.to_f&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
 Class def: &lt;br /&gt;
&lt;br /&gt;
   class Interest_calc&lt;br /&gt;
     def push(n)&lt;br /&gt;
       @args ||= []&lt;br /&gt;
       @args&amp;lt;&amp;lt;n&lt;br /&gt;
     end&lt;br /&gt;
&lt;br /&gt;
     def calc&lt;br /&gt;
       @args.inject(0){|p,r| p=p*r/100}&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66516</id>
		<title>CSC/ECE 517 Fall 2012/ch1b 1w71 gs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1b_1w71_gs&amp;diff=66516"/>
		<updated>2012-10-03T21:38:57Z</updated>

		<summary type="html">&lt;p&gt;Ggsingh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cucumber and Capybara=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Cucumber is one of the latest additions to the RSpec family of tools for testing in Ruby. Testing is one of the most important parts of the Ruby culture. It allows programmers and software development teams to describe feature based tests in plain text definitions known as &amp;quot;stories&amp;quot;. This text is written in a business readable domain-specific language(DSL) known as Gherkin. &lt;br /&gt;
&lt;br /&gt;
Though Cucumber is a testing tool, the main intent of its development is to support Behavior Driven Development(BDD). This implies that the tests written in DSL are typically written before any other part of the code is written. It is analysed by the non technical stakeholders and then the production code is written. The production code is thus written outside-in, in such a way that the tests pass. &lt;br /&gt;
&lt;br /&gt;
== Cucumber vs Previous Stories based Testing tools ==&lt;br /&gt;
&lt;br /&gt;
Cucumber is actually Aslak Hellesoy's revamp of RSpec's &amp;quot;Story Runner&amp;quot;(by Dan North). The earlier versions of &amp;quot;Stroy Runner&amp;quot; and its predecessor RBehave required that the stories be written in Ruby. But seeing the associated inconvenience, David Chelimsky added the plain text support with contributions done from an eclectic support team. &lt;br /&gt;
&lt;br /&gt;
In April 2008, Aslak Hellesoy started the Cucumber project to iron out the inherent flaws and glictches of the RSpec Story Runner. Joseph Wilk and Ben Mabey were the regular contributors to the project. Matt Wynne joined in September 2009. In October 2009, Mike Sassak and Gregory Hnatiuk did some great work on a faster parser for Cucumber. In addition to the core team, there were over 250 developers contirbuting to the overall development of the project.&lt;/div&gt;</summary>
		<author><name>Ggsingh</name></author>
	</entry>
</feed>