Answered question

Js script content is not saved after I close and reopen neoload

var lock = new java.util.concurrent.locks.ReentrantLock();
var WFE_CreateSavedSearch = context.variableManager.getValue("WFE_CreateSavedSearch");

if (WFE_CreateSavedSearch==null)
{
context.fail("Variable 'WFE_CreateSavedSearch' not found");
}
function writeFile(text)
{
lock.lock();

var writer = new java.io.FileWriter("c:\\log.txt",true);
writer.write(WFE_CreateSavedSearch+";"+context.currentVU.id+";"+text);
writer.write("\r\n");
writer.close();
lock.unlock();
}


var WFE_CreateSavedSearch = context.variableManager.getValue("WFE_CreateSavedSearch");

if (WFE_CreateSavedSearch==null)

{

context.fail("Variable 'WFE_CreateSavedSearch' not found");

}
writeFile(WFE_CreateSavedSearch+";was the value from my test");

When Ever I close neoload and reopen all this cod ei gone! I can't see it back. any idea?


I got 4 different scripts like this and I want to keep them in a JS libriay file as functions and use them or call the,.

How can I do that? Can some one help me in doing this?

Appreciate your help on this

Anonymous
Anonymous

Anonymous

Level
0
17 / 100
points
christophe M.
christophe M.

christophe M.

Level
4
5000 / 5000
points
Team

Hi,

I double-checked that saving a Javascript code works properly with NeoLoad 5.0.2 (Project needs to be saved). You may look at the log file of the Controller to see if everything is normal. "Help / Open Logs Folder" and check "neoload.log".

If you want oto declare a Javascript function once and reuse it then you must put it in a Javascript library (menu "Edit / Javascript libraries")

Did you find this useful ?

No (0)

Yes (0)

0% of users found this answer useful