我已经构建了一个加载 URL 并显示加载时间的网络加载器。我的问题是,如何在此站点中添加虚拟用户以同时执行多个用户测试以对所选 URL 进行压力测试。
<html>
<head>
<script type="text/javascript">
beforeload = (new Date()).getTime();
function pageloadingtime()
{
afterload = (new Date()).getTime();
seconds = (afterload-beforeload)/1000;
document.getElementById("loadingtime").innerHTML = "<font color='red'>(You Page Load took " + seconds + " second(s).)</font>";
}
</script>
<title>load time</title>
</head>
<body>
<div id="loadingtime"></div>
<script type="text/javascript">
function Reload() {
beforeload = (new Date()).getTime();
var f = document.getElementById('iFrame');
f.src = f.src;
}
</script>
<script type="text/javascript">
function submitStuff(){
document.getElementById('iFrame').src = 'http://' + document.theForm.url.value;
return false ;
}
</script>
<form name="theForm" method="post" onsubmit="return submitStuff();">
<input name="url" value="" >
<input type="submit" name="submitButton" value="Submit/Refresh" onclick="Reload();">
</form>
<iframe id="iFrame" width="1320" height="540" src="http://www.default.com" onload="pageloadingtime();"></iframe>
</body>
</html>