Search code examples
javafitnessefitnesse-slim

How to test a java class using FitNesse


I have been trying to test my java class using FitNesse tool, but I get some errors:

This is my Addition.java

public class Addition{
    private double firstnum, secondnum;

    public void setFirstnum(double firstnum){
         this.firstnum = firstnum;
    }

    public void setSecondnum(double secondnum){
            this.secondnum = secondnum;
    }

    public double result(){
        return firstnum + secondnum;
    }
}

And I have compiled this program and made its class.

And this is how my FitNesse table looks like

!***< Hidden

!define TEST_SYSTEM {slim}
!path C:\Users\Jananath Banuka\Desktop\FitNesse\classes

|eg.Addition|
|firstnum |secondnum  |result?  |
|10       |2          |12       |
|12.6     |3          |15.6     |

But I get this error, which I don't know. Below is my error

Error

Can someone please tell me what is wrong?


Solution

  • Assuming your compilation did generate C:\Users\Jananath Banuka\Desktop\FitNesse\classes\eg\Addition.class I believe the problem might be with the space in your username.

    Can you try copying your code to another directory without spaces in its path, update the wiki accordingly and try again? (E.g. move the compile output to C:\temp\FitNesse\classes\eg\Addition.class, and change the !path to !path C:\temp\FitNesse\classes)