Tuesday 23 August 2022

Get epoch timestamp in Neoload | epcoh time stamp java script with neoload

if you want to generate the epoch timestamp in Neoload, its so simple you just need to write 4 lines of java script and can pass the same variable to your requests.


var time = new Date()
var Timestamp = Math.round(time.getTime() / 1000)

logger.debug("time="+Timestamp);
context.variableManager.setValue("time",Timestamp);






How to delete unwanted files and results folders from LoadRunner scripts folders

When you are running load runner script for multiple iterations, it may pileup the logs and idx files in the script folder, which causes the more memory consumption for script folders. To get rid of this, we can execute a simple batch file . Copy all the below code and paste it in a notepad and name it as LRCleanUP.bat batch file. Then go to LR scripts folder and double click on it.

This batch file can be run either from within a script folder, or from a top-level folder containing multiple LoadRunner scripts. If run in a top level folder it loops through all sub-folders deleting files and results folders as it goes. It deletes unwanted log files and output files

IF EXIST %temp%blankfile.txt  del %temp%blankfile.txt /q
IF EXIST %temp%FilesDeleted.txt  del %temp%FilesDeleted.txt /q
IF EXIST %temp%FoldersDeleted.txt  del %temp%FoldersDeleted.txt /q
IF EXIST %temp%BadParms.txt  del %temp%BadParms.txt /qtype nul > %temp%blankfile.txt
type nul > %temp%FilesDeleted.txt
type nul > %temp%FoldersDeleted.txt
type nul > %temp%BadParms.txt
del *.idx /s >> %temp%FilesDeleted.txt
del mdrv*.log /s >> %temp%FilesDeleted.txt
del mdrv.txt /s >> %temp%FilesDeleted.txt
del options.txt /s >> %temp%FilesDeleted.txt
del *.ci /s >> %temp%FilesDeleted.txt
del combined_*.c /s >> %temp%FilesDeleted.txt
del output.txt /s >> %temp%FilesDeleted.txt
del debug.inf /s >> %temp%FilesDeleted.txt
del *.bak /s >> %temp%FilesDeleted.txt
for %%d in (h) do (
for /f “delims=” %%a in (‘dir/s/b/ad “%CD%result*”‘) do (
echo “deleted %%a” >> %temp%FoldersDeleted.txt
rd /s /q “%%a”
)
)
rd result1 /s /q
findstr /S “:\” *.prm > %temp%BadParms.txt
fc %temp%FilesDeleted.txt %temp%blankfile.txt > nul
if errorlevel 1 “Notepad.exe” “%temp%FilesDeleted.txt”
fc %temp%FoldersDeleted.txt %temp%blankfile.txt > nul
if errorlevel 1 “Notepad.exe” “%temp%FoldersDeleted.txt”
fc %temp%BadParameters.txt %temp%blankfile.txt > nul
if errorlevel 1 “Notepad.exe” “%temp%BadParms.txt”
IF EXIST %temp%blankfile.txt  del %temp%blankfile.txt /q
IF EXIST %temp%FilesDeleted.txt  del %temp%FilesDeleted.txt /q
IF EXIST %temp%BadParms.txt  del %temp%BadParms.txt /q