groovy - Groovy 类可以用作 FitNesse 固定装置吗
问题描述
我正在学习 FitNesse 框架,想知道是否可以用 Groovy 编写夹具代码。所以我复制了一个示例决策表,将原始类重命名为ShouldIBuyMilkJava
并创建了一个具有相同功能的 Groovy 类。所以我的设置是这样的:
wiki 测试页面(为简洁起见省略了表格行):
|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 |
应该买牛奶Java.java:
与此处相同,只是将类重命名为ShouldIBuyMilkJava
应该购买MilkGroovy.groovy:
class ShouldIBuyMilkGroovy {
def dollars
def pints
boolean creditCard
ShouldIBuyMilkGroovy() {
}
// the rest is omitted for brevity
这两个类都编译成功,并且位于测试页面中作为类路径导入的文件夹中。第一个测试成功通过,但第二个我得到一个异常Could not invoke constructor for ShouldIBuyMilkGroovy[0]
。
我尝试从 Groovy 类中删除一个空的无参数构造函数——结果相同。
如何让 Groovy 类作为 FitNesse 固定装置工作?
解决方案
所以,修复很简单——我必须将!path
指向 groovy 库的指令包含到 FitNesseroot
页面中,而不是包含在测试页面中。
推荐阅读
- paypal - Paypal 争议沙盒测试,触发 CUSTOMER.DISPUTE.RESOLVED 事件
- java - 构建android源代码以获得完整的android.jar和源代码
- mysql - MySQL“启动”在 ubuntu 20.04 中失败
- menu - 如何使弹出菜单不可见?
- css - 如何删除引导按钮中的小蓝线?
- sql - 如何限制 Postgres sql 中的重复行
- azure - Terraform azure 提供商给了我“未设置功能必填字段”
- spring-security - Spring Authorization Server + Feign 的问题
- python - “'charmap' 编解码器无法在位置 510335 对字符 '\u015f' 进行编码:字符映射到
" 在 Altair 中加载 csv 时 - javascript - 为什么我不能在不使用加号的情况下使用在引号内使用变量的方式?