0

I'm getting following error when executing test case in fitnesse:

The instance decisionTable_0.setFirst. does not exist

Below link has the screenshot:

https://github.com/unclebob/fitnesse/issues/1078

Below is the fixture java code: package FitnesseExamples;

public class Calculator {
private int first, second;

public void setFirst(int first){
    this.first = first;
}
public void setSecond(int second){
    this.second = second;
}
public int addition(){

    return(first+second);
}

public int minus(){
    return(first-second);
}

public int multiply(){

    return(first*second);
}

public float divide(){
    return(first/second);
}
}

Below is the wiki test:

!define TEST_SYSTEM {slim}

!path C:\Shyam\Automation\Workspace\AddNumber\src\FitnesseExamples

!|Calculator|
|first|second|addition?|minus?|multiply?|divide?|
|4 |2 |6 |2 |8 |2.0 |
|10 |5 |15 |5 |50 |2.0 |
|10 |10 |20 |0 |100 |1.0 |

My Calculator.class file is present in the following location:

C:\Shyam\Automation\Workspace\AddNumber\src\FitnesseExamples

  • Below is the error: __EXCEPTION__:java.lang.NoClassDefFoundError: Calculator (wrong name: FitnesseExamples/Calculator) at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0_131] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) [rt.jar:1.8.0_131] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.8.0_131] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) [rt.jar:1.8.0_131] at java.net.URLClassLoader.access$100(URLClassLoader.java:73) [rt.jar:1.8.0_131] at java.net.URLClassLoader$1.run(URLClassLoader.java:368) – Shyam Varma Sep 04 '17 at 13:05
  • I got the solution: As the class is not in the default package package FitnesseExamples; Should try this way: !define TEST_SYSTEM {slim} !path C:\Shyam\Automation\Workspace\AddNumber\src !|FitnesseExamples.Calculator| |first|second|addition?|minus?|multiply?|divide?| |4 |2 |6 |2 |8 |2.0 | |10 |5 |15 |5 |50 |2.0 | |10 |10 |20 |0 |100 |1.0 | – Shyam Varma Sep 04 '17 at 14:10

0 Answers0