首页 > 解决方案 > 不能再在 groovy 中使用 format() 和 plus() 进行 ReadyAPI 测试

问题描述

嗨,我之前在为 ReadyAPi 编写 groovy 脚本时通过例如 data().plus(1).format('dd-mmm-yyyy') 添加了日期,我已将 Ready API 更新到 3.3.2 版并且这些停止工作为了我。我不能再使用这些方法了。有没有其他方法可以获得相同的结果

def startdate = new Date().plus(1).format("yyyy-MM-dd")
log.info startdate
def enddate = new Date().plus(2).format('yyyy-MM-dd')
log.info enddate

收到以下错误

groovy.lang.MissingMethodException: No signature of method: java.util.Date.plus() is applicable for argument types: (Integer) values: [1] Possible solutions: parse(java.lang.String), is(java.lang.Object), split(groovy.lang.Closure), use([Ljava.lang.Object;), wait(), clone() error at line: 1

请帮忙。它完全破坏了我的测试套件

标签: javascriptgroovydate-format

解决方案


推荐阅读