130 likes | 433 Views
Fitnesse (Lab). Alessandro Marchetto Fondazione Bruno Kessler - IRST. Outline. Fitnesse Installation Fitnesse: starting with a running example Exercises Try to install Try to run the running example Try to do the exercises. Install and run Fitnesse. Load http://fitnesse.org
E N D
Fitnesse (Lab) Alessandro Marchetto Fondazione Bruno Kessler - IRST
Outline • Fitnesse Installation • Fitnesse: starting with a running example • Exercises • Try to install • Try to run the running example • Try to do the exercises
Install and run Fitnesse • Load http://fitnesse.org • Click on “Download Fitnesse and Plugins” • Download “fitnesse.jar” • Lunch “java -jar fitnesse.jar” • …. Open a Browser and lunch “http://localhost:80” Please, see the documentation
2 1 3 Install Fitnesse in Eclipse (I) • Download the Eclipse plugin (in a local directory) • http://www.bandxi.com/fitnesse/com.bandxi.fitnesse_v1.0.2.zip • Install the plugin in your Eclipse • Lunch Eclipse • Select “Help Software Update…” • Select “Available SoftwareAdd Site Archieve …”
5.2 6 Install Fitnesse in Eclipse (II) • Chooice the com.bandxi.fitnesse_v1.0.2.zip file and confirm • Click “Install” • (before lunching the installation) Check the correct package only • (during the installation) Read and accept the licence • When restarting Eclipse… the Fitnesse plugin will be installed • (Check the presence of the Fitnesse icons) 4 5.1
Our running example: Sum Calculator public class MySum { public static int sum (int a, int b) { return a+b; } } public class MyFixture extendsColumnFixture { int a,b; public int sum () { return MySum.sum(a,b); } } A full demo: http://softeng.polito.it/courses/tutorial/FitnesseInEclipse.html
Step-by-Step (I) 1. Create a new “Java Project” in Eclipse, called “MathOperators” 2. Write the class “Add” in the package “math” with a method “sum” that takes two integer and returns the sum package math; publicclass Add { publicstaticint sum (int a, int b){ return a+b; } }
3. In the Eclipse project create a new directory called “Fitnesse” and add the • Fitnesse library to the classpath • select the project right botton of the mouse New Folder … • select the project right botton of the mouse Fitnesse Add Fitnesse libraries… • Select the new “Fitnesse” directory and start Fitnesse on it • select the directory right botton of the mouse FitNesse • Lunch FitNesse runtime on this folder … Confirm initialization … • … A new fitnesse wiki is starting for the current project 3 4
5 5. In the wiki click “Edit” to edit the table 6. Edit the table and save it 6
7. See the table and try to run it. To run: 1. In the wiki click “Properties” to make the page executable 2. Check “Test” and click “Save Properties” 8. In the wiki click “Test” to run the test … 7.1 7.2 8 We need the fixture!
9. In the Eclipse project create a new package “fitures” 10.In the “fixtures” package create the fixtures.MyFixture fixture extending the ColomnFixture … package fixtures; import math.Add; import fit.ColumnFixture; public class MyFixture1 extends ColumnFixture { public int a; public int b; public int sum(){ int result; return Add.sum(a,b); } }
Exercises… • Install Fitnesse • Run the running example • Download the exercise specifications • http://selab.fbk.eu/swat/exercises/fitneese-1.ppt • For each exercise: • Read its specification • Try to apply the black-box testing technique to identify test cases • Implement such test cases in Fitnesse • Run them