How to get the epoch time in the readyapi using the groovy scripts
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2023
06:36 PM
05-07-2023
06:36 PM
How to get the epoch time in the readyapi using the groovy scripts
Unable to get the current time in milliseconds
Labels:
- Labels:
-
Data-Driven Testing
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2023
06:39 PM
05-07-2023
06:39 PM
Can you please address this issue at the earliest. I would really appreciate your help.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023
03:34 AM
05-08-2023
03:34 AM
Hi,
The below code segment works....
import java.util.concurrent.TimeUnit;
def epoch = System.currentTimeMillis();
log.info(epoch);
log.info(epoch.toString());
Your example must be incomplete though.
The part I don't get is...
result["time"] = epoch.toString();
Extending the above to include this....
import java.util.concurrent.TimeUnit;
def epoch = System.currentTimeMillis();
log.info(epoch);
log.info(epoch.toString());
result["time"] = epoch.toString();
Running returns the following error....
Mon May 08 11:30:43 BST 2023:ERROR:An error occurred [No such property: result for class: Script6], see error log for details
Can you share more of your example or be clearer about what you want to achieve?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2023
06:41 AM
05-16-2023
06:41 AM
long epoch = System.currentTimeMillis()/1000
