简体   繁体   English

无法调用 CreatePrograms[0] 的构造函数 (FitNesse SLiM)

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

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.我已按照本网站 ( https://schuchert.wikispaces.com/FitNesse.Tutorials.0.Java ) 的指示进行操作,但我无法让 FitNesse 上的代码运行干净。

I am consistently getting the following exceptions:我一直收到以下例外情况:

|Create Programs Could not invoke constructor for CreatePrograms[0] |创建程序无法调用 CreatePrograms[0] 的构造函数

|House The instance decisionTable_1.setName. |House 实例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=|

Could not invoke constructor for CreatePrograms[0] 无法为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. 该错误告诉您测试执行无法在其启动的类路径(从!path语句累积)中找到灯具代码。

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. 鉴于您正在Mac OS上运行,如果在不使用前面的“ /”的情况下指定它,它将成为您启动服务器的位置的相对路径。

Another thing to check is that ensure right under .../bin you have com/om/example/dvr/fixtures and the .class files are there. 要检查的另一件事是,确保就在.../bin您拥有com/om/example/dvr/fixtures ,并且.class文件在那里。


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|

try to edit the root page and define classpath and variables there: ie http://localhost:8090/root 尝试编辑根页面并在其中定义类路径和变量:即http:// localhost:8090 / root

#!***> Classpath

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

#*!

对我而言,当我在SetUp文件夹下的content.txt中添加类包名称时,它起作用了,因此可以为测试设置类路径。

This error occurred because of missing class file or jar file in the path.发生此错误是因为路径中缺少 class 文件或 jar 文件。

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 . targer/*.jar = 对于 maven 项目,仅在mvn clean install之后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM