Fitnesse

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
Note.gif Note:

Fitnesse is now upgraded to FitnesseSlim. Sample integration code and actual testing done there.

Getting Started

  • What is FitNesse?

Reference:http://fitnesse.org/FitNesse.UserGuide.OneMinuteDescription

  • Downloading And Installing FitNesse

Reference:http://fitnesse.org/FitNesse.UserGuide.DownloadingAndInstallingFitNesse

  • Test example

If you want to see the example,download the .zip file.and decompress it.

1.Run "run.sh" or "java -jar fitnesse.jar".

2.Open browser http://localhost/, click "A Two-Minute Example".

3.Running our test table: Click the Test button

Here we can see hava a wrong information.the last line is wrong.

Edit the page.if hava not "Edit button", click "Properties" button.select "edit" and "Save Properties".

4.Then click "edit" button.Modify the table last line, 33 to 25.0,save.

5.Retest it.

How fitnesse testing?

"eg.Division" is "Division" class under "eg" packages.this class we can find it at fitnesse.jar.view the source code:

package eg;
import fit.ColumnFixture;
public class Division extends ColumnFixture { 
    public double numerator;
    public double denominator; 
    public double quotient(){ 
       return  numerator/denominator; 
    } }

Create Example AcceptanceTest

  • Edit the FrontPage and add the link ExampleAcceptanceTest. Click save.

o You should see ExampleAcceptanceTest? appear on the screen.

  • Click on the ? to open the page.

o This will open an edit window on the page FrontPage.ExampleAcceptanceTest. o Add the following to the page:

|myFixtures.rightTriangle|
|a|b|c|right()|
|3|4|5|true|
|6|8|10|true|
|3|5|9|false|
  • Click on properties.

o click the test check box,hit save.

  • Click on Front Page? and then on ExampleAcceptanceTest to get back to the test page.
  • Click on the ? after root

o Add the following to the ClassPath page:

!path fitnesse.jar
!path FitNesseRoot/files/examples

and hit save.

  • Create the following java program:
package myFixtures;
import fit.ColumnFixture;
public class rightTriangle extends ColumnFixture
{
  public double a;
  public double b;
  public double c;
  public boolean right()
  {
    return (a*a+b*b)==(c*c);
  }
}

Save this program in fitnesse_home/FitNesseRoot/files/examples/myFixtures

  • Compile this program.

You can do this by going to the fitnesse_home/FitNesseRoot/files/examples directory and typing the following command:

javac -classpath ../../../fitnesse.jar myFixtures/rightTriangle.java

Or perhaps you have a better way…

  • Hit the test button on the ExampleAcceptanceTest screen.

The cells in the right() column should all turn green.

Fit6.png

References:

Links