Could not invoke constructor for CreatePrograms[0] (FitNesse SLiM)

Julie S picture Julie S · Oct 22, 2014 · Viewed 9.5k times · Source

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=|

Answer

Xiawei Zhang picture Xiawei Zhang · Nov 30, 2015

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|