'How to check if the latest downloaded file is having the current time and date?
How to check if the latest downloaded file is having the current time and date using Pace Automation Framework ?
Solution 1:[1]
Sample code :
Use a custom tag :
#Tag=getLastModifiedFile, Att1=path, Att2=keyName
getLastModifiedFile=com.tr.execution.activities.GetLastModifiedFile
<activities>
<activity id="ticket">
<getLastModifiedFile path="./sample_xml" keyName="file"></getLastModifiedFile>
<variable keyName="download_file" expression="var x ='${file}'.split('_'); x[5];" ></variable>
<variable keyName="date" expression="var x ='${download_file}'.split('T'); x[0];" ></variable>
<variable keyName="time" expression="var x ='${download_file}'.split('T'); x[1];" ></variable>
<variable keyName="input_date_time" value="${date}${time}" ></variable>
<date timezone="UTC" keyName="output_date_time" format="yyyyMMddhhmm"></date>
<validation valGroupIds="Check_Date"></validation>
</activity>
<valGroup groupId="Check_Date">
<validate variable="input_date_time" condition="equals" value="${output_date_time}" passMsg="PASSED" failMsg="FAILED" desc="VALIDATE TAG" expResult="VALIDATE the validation" >
</validate>
</valGroup>
</activities>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Aneetta Sara |
