Groovy 类 可以用作FitNesse fixtures吗

Can Groovy classes be used as FitNesse fixtures

我正在学习 FitNesse 框架,想知道是否可以在 Groovy 中编写 fixture 代码。所以我复制了一个示例 Decision Table,将原来的 class 重命名为 ShouldIBuyMilkJava 并创建了一个具有相同功能的 Groovy class。所以我的设置是这样的:

wiki 测试页(为简洁起见省略了 table 行):

|should I buy milk Java                                         |
|cash in wallet|credit card|pints of milk remaining|go to store?|
|0             |no         |0                      |no          |
|10            |no         |0                      |yes         |

|should I buy milk Groovy                                       |
|cash in wallet|credit card|pints of milk remaining|go to store?|
|0             |no         |0                      |no          |
|10            |no         |0                      |yes         |

ShouldIBuyMilkJava.java:

here相同,只是class重命名为ShouldIBuyMilkJava

ShouldIBuyMilkGroovy.groovy:

class ShouldIBuyMilkGroovy {
    def dollars
    def pints
    boolean creditCard

    ShouldIBuyMilkGroovy() {

    }

    // the rest is omitted for brevity

两个 classes 都编译成功并且位于作为测试页中的 classpath 导入的文件夹中。第一个测试成功通过,但第二个测试出现异常 Could not invoke constructor for ShouldIBuyMilkGroovy[0]

我尝试从 Groovy class 中删除一个空的无参数构造函数 - 结果相同。

如何让 Groovy classes 像 FitNesse 固定装置一样工作?

因此,修复很简单 - 我必须将指向 groovy 库的 !path 指令包括到 FitNesse root 页面中,而不是测试页面中。