version 6.10.0
NeoLoad CurrentDate variable doesn't get updated during runtime.
I have tried Local and Global and each change policy but each run inserts the datetime when the variable was created.
Here is a working project from 6.10
Hi Neil,
Thanks but nope. This is not a formatting issue, it's that the CurrentDate variable provided by NeoLoad doesn't update.
My workaround is to code it:
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+' '+time;
this is working.
Could it be a defect with the app?
I will try with v6.10 tomorrow (well later today now) but v7 is out so maybe an upgrade is needed.
I can't reproduce that issue in NeoLoad 6.10. Could you provide more information about your use case like when/where and how often the variable is called?
here is my js:
var lock = new java.util.concurrent.locks.ReentrantLock();
var currDate = context.variableManager.getValue("CurrentDate");
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+' '+time;
lock.lock();
var writer = new java.io.FileWriter("c:/currDate.txt",true);
writer.write(currDate);
writer.write(" -- ")
writer.write("NeoLoad Variable")
writer.write("\r\n");
writer.write(dateTime);
writer.write(" -- ")
writer.write("\r\n");
writer.close();
lock.unlock();
i added a 1s delay and ran in 100 times in the UserPath checker comparing NeoLoad CurrentDate variable and my js variable. The results are in the file below. You will notice that my date variable changes but the NeoLoad canned variable does not. It shows the date that the variable was created.
We would need to see some screenshots of how you have created this, I can create a quick demo project and share it here.
sure, go ahead
thanks Neil,
i noticed that your currDate variable was different than mine. it appears that the variable was not correctly created. once corrected, the date does update.