【发布时间】:2018-05-07 16:28:35
【问题描述】:
我创建了一个包含大量 javascript 函数的功能文件。
在不同的功能文件中,我想使用其中一个功能(并传入一个值)。
请问我该怎么做?
我的功能文件名为 SystemSolentraCustomKarateMethods.feature
这是当前内容(目前只包含一个函数):
Feature: System Solentra Status Test
Background:
* def checkreturneddatetimeiscorrect =
#The following code compares the passed in datetime with the current systemdatetime and
#makes sure they are within 2 seconds of each other
"""
function(datetime) {
var datenow = new Date();
karate.log("***The Date Now = " + datenow.toISOString() + " ***");
var timenow = datenow.getTime();
karate.log("***The Time Now in Milliseconds = " + timenow+ " ***");
karate.log("***The Passedin Date = " + datetime + " ***");
var passedintime = new Date();
passedintime = Date.parse(datetime);
karate.log("***The Passed in Time = " + passedintime+ " ***");
var difference = timenow - passedintime;
karate.log("***The Time Difference = " + difference + " milliseconds ***");
return (difference < 2000)
}
"""
【问题讨论】:
标签: karate