0

I have followed the directions from this website (https://schuchert.wikispaces.com/FitNesse.Tutorials.0.Java) to the t, however I cannot get the code on FitNesse to run clean.

I am consistently getting the following exceptions:

|Create Programs Could not invoke constructor for CreatePrograms[0]

|House The instance decisionTable_1.setName. does not exist

Here is my code. I have ensured my classpath is correct. Thank you for your time and consideration - I am very frustrated and confused with this.

!contents -R2 -g -p -f -h
!define TEST_SYSTEM {slim}

!path fitnesse-standalone.jar

!define COLLAPSE_SETUP {true}
!define COLLAPSE_TEARDOWN {true}

!path Users/Julianne/src/fitnesse-tutorials/DVR/bin/
|import|
|com.om.example.dvr.fixtures|


!|Create Programs                                        |
|Name |Channel|DayOfWeek|TimeOfDay|DurationInMinutes|id? |
|House|4      |Monday   |19:00    |60               |$ID=|
Xiawei Zhang
  • 1,690
  • 1
  • 11
  • 24
Julie S
  • 9
  • 1
  • 1
  • 2

5 Answers5

1

Could not invoke constructor for CreatePrograms[0]

This error tells you that the test execution cannot find the fixture code in the classpath (accumulated from !path statements) that it launches.

It looks like you are giving a relative path here

!path Users/Julianne/src/fitnesse-tutorials/DVR/bin/

Given that you are running on Mac OS, if you specify it without the preceding '/', it becomes a relative path from the location that you launch your server.

Another thing to check is that ensure right under .../bin you have com/om/example/dvr/fixtures and the .class files are there.


On a side note: A useful trick to check the resulted classpath for the test execution is to add the following block to somewhere on test page (or included setup page)

|script     |java properties|
|show   |property   |java.class.path|
Xiawei Zhang
  • 1,690
  • 1
  • 11
  • 24
0

try to edit the root page and define classpath and variables there: i.e. http://localhost:8090/root

#!***> Classpath

!path ${java.class.path}
!define TEST_SYSTEM {slim}
!define COLLAPSE_SETUP {true}
!define COLLAPSE_TEARDOWN {true}

#*!
PepsiGoose
  • 377
  • 3
  • 4
  • it does not matter where you put the `!path` statement. It will only affect the sequence in the final generated classpath string if the !path is in a subpage (behind) or on a root page (in the front). – Xiawei Zhang Nov 30 '15 at 12:55
0

For me it worked when I added the class package name in the content.txt under SetUp folder so somewhat similar structure would be there to setup classpath for the test.

Rakesh
  • 4,004
  • 2
  • 19
  • 31
0

This error occurred because of missing class file or jar file in the path.

Try using below in the same test page rather than in setup page or root page:

!define TEST_SYSTEM {slim}
!path target/*.jar
!path lib/*.jar

where,

targer/*.jar = For maven project only after mvn clean install.

Punit Tiwari
  • 496
  • 4
  • 8
0

I struggled with this same error for a few days. I found that I was including too much information in my !path on the fitnesse page. I was including information which was already in my JAVA "package" statement.

If the class is within a package provide the path to the folder where the package starts.

for example, my CreditsForPayment.Class includes "package jukebox.fixtures;". The complete path to my class is: C:\Users\Brandon\IdeaProjects\untitled\out\production\untitled\jukebox\fixtures\CreditsForPayment.Class

, but in order for Fitnesse to properly find my class, I must use the path.

C:\Users\Brandon\Ideaprojects\untitled\out\production\untitled

with

|import|

|jukebox.fixtures| in my Fitnesse page.

Then you can go ahead with calling the class.

!|CreditsForPayment|

|payment|credits?|

|1|4|

From the https://dzone.com/refcardz/getting-started-fitnesse example.