I have some set of api's before executing them i need to change system date every time. Is there any method to change system date in jmeter?
-
Scene is we have a system in which we create loans, this loans has emi's and we need to calculate late fees on basis of arrears(if someone missed any emi), so for that we have a **program** (not api) called scheduler which runs every mid night(takes system date) and check for the arrears. So for testing purpose we need to check different scenarios. To automate this we need to change system date at runtime to meet the requirement. – MUSADDIK Feb 24 '20 at 12:09
1 Answers
It is, given you run JMeter under a user account which has enough permissions in order to amend the date/time of the underlying operating system.
The relevant command is date
for both Windows and Unix OS families and the command can be invoked using OS Process Sampler
If this is really something you need to implement check out How to Run External Commands and Programs Locally and Remotely from JMeter article for comprehensive instructions and example implementations for different operating systems.
However your test design looks a little bit suspicious, I don't think your API knows anything about the client operating system date/time, if you're passing a timestamp as a parameter of the API request it makes sense to modify this timestamp via i.e. __timeShift() function, not the underlying operating system date/time

- 159,985
- 5
- 83
- 133
-
Hi @Dmitri T, Scene is we have a system in which we create loans, this loans has emi's and we need to calculate late fees on basis of arrears(if someone missed any emi), so for that we have a **program** (not api) called scheduler which runs every mid night(takes system date) and check for the arrears. So for testing purpose we need to check different scenarios. To automate this we need to change system date at runtime to meet the requirement. – MUSADDIK Feb 24 '20 at 12:05