update behavior and page
This commit is contained in:
parent
def1229fad
commit
054af23c0f
|
@ -2,6 +2,7 @@ package org.bench4q.web.api;
|
|||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -9,6 +10,8 @@ import javax.xml.bind.JAXBContext;
|
|||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
|
||||
import org.bench4q.web.model.ResultInfoModel;
|
||||
import org.bench4q.web.model.TestResult;
|
||||
|
||||
|
|
|
@ -7,7 +7,9 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.helper.ExceptionLog;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
|
@ -20,7 +22,7 @@ import org.bench4q.share.models.master.TestPlanResultModel;
|
|||
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptPageBriefModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
|
||||
import org.bench4q.web.init.TestResultHandle;
|
||||
import org.bench4q.web.masterMessager.TestPlanMessager;
|
||||
import org.bench4q.web.model.ResultInfoModel;
|
||||
|
@ -271,7 +273,7 @@ public class TestPlanController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@RequestMapping("/{testPlanId}/script/{scriptId}/behaviors")
|
||||
@RequestMapping("/{testPlanId}/{scriptId}/behaviors")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getScriptBehaviorBriefModel(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
|
@ -284,24 +286,24 @@ public class TestPlanController extends BaseController {
|
|||
return fail(map, "");
|
||||
}
|
||||
map = success(map);
|
||||
map.put("result", scriptBehaviorsBriefModel);
|
||||
map.put("behaviors", scriptBehaviorsBriefModel);
|
||||
return map;
|
||||
}
|
||||
|
||||
@RequestMapping("/{testPlanId}/script/{scriptId}/page")
|
||||
@RequestMapping("/{testPlanId}/{scriptId}/page")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getScriptPageBriefModel(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@PathVariable String testPlanId, @PathVariable String scriptId) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
ScriptPageBriefModel scriptPageBriefModel = this.getTestPlanMessager()
|
||||
ScriptPagesBriefModel scriptPagesBriefModel = this.getTestPlanMessager()
|
||||
.getScriptPageBriefModel(accessToken, testPlanId, scriptId);
|
||||
|
||||
if (scriptPageBriefModel == null) {
|
||||
if (scriptPagesBriefModel == null) {
|
||||
return fail(map, "");
|
||||
}
|
||||
map = success(map);
|
||||
map.put("result", scriptPageBriefModel);
|
||||
map.put("pages", scriptPagesBriefModel);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package org.bench4q.web.masterMessager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.communication.HttpRequester;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
|
@ -71,12 +69,4 @@ public abstract class MasterMessager {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected String buildUrl(List<String> urls) {
|
||||
String url = "";
|
||||
for (String urlPart : urls) {
|
||||
url += "/" + urlPart;
|
||||
}
|
||||
return url;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,7 @@ package org.bench4q.web.masterMessager;
|
|||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
|
@ -16,7 +13,7 @@ import org.bench4q.share.models.master.TestPlanResultModel;
|
|||
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptPageBriefModel;
|
||||
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
|
@ -97,8 +94,8 @@ public class TestPlanMessager extends MasterMessager {
|
|||
|
||||
public ScriptBehaviorsBriefModel getScriptBehaviorsBriefResult(
|
||||
String accessToken, String testPlanId, String scriptId) {
|
||||
String url = this.getBaseUrl()
|
||||
+ this.buildUrl(createUrlPartList(testPlanId, scriptId));
|
||||
String url = this.getBaseUrl() + "/getBehaviorsBrief" + "/"
|
||||
+ testPlanId + "/" + scriptId;
|
||||
HttpResponse httpResponse = null;
|
||||
try {
|
||||
httpResponse = this.getHttpRequester().sendGet(url, null,
|
||||
|
@ -167,12 +164,6 @@ public class TestPlanMessager extends MasterMessager {
|
|||
}
|
||||
}
|
||||
|
||||
private List<String> createUrlPartList(String testPlanId, String scriptId) {
|
||||
List<String> urlParts = new LinkedList<String>();
|
||||
urlParts.add(testPlanId);
|
||||
urlParts.add(scriptId);
|
||||
return urlParts;
|
||||
}
|
||||
|
||||
private TestPlanResponseModel getTestPlanResponseModel(String url,
|
||||
Map<String, String> params, String accessToken) {
|
||||
|
@ -252,9 +243,9 @@ public class TestPlanMessager extends MasterMessager {
|
|||
}
|
||||
}
|
||||
|
||||
public ScriptPageBriefModel getScriptPageBriefModel(String accessToken,
|
||||
public ScriptPagesBriefModel getScriptPageBriefModel(String accessToken,
|
||||
String testPlanId, String scriptId) {
|
||||
String url = this.baseUrl + "/pageBrief" + "/" + testPlanId + "/"
|
||||
String url = this.baseUrl + "/pagesBrief" + "/" + testPlanId + "/"
|
||||
+ scriptId;
|
||||
HttpResponse httpResponse = null;
|
||||
try {
|
||||
|
@ -264,8 +255,8 @@ public class TestPlanMessager extends MasterMessager {
|
|||
handleInvalidatedResponse(url);
|
||||
return null;
|
||||
}
|
||||
return (ScriptPageBriefModel) MarshalHelper.unmarshal(
|
||||
ScriptPageBriefModel.class, httpResponse.getContent());
|
||||
return (ScriptPagesBriefModel) MarshalHelper.unmarshal(
|
||||
ScriptPagesBriefModel.class, httpResponse.getContent());
|
||||
|
||||
} catch (Exception e) {
|
||||
handleException(httpResponse, e);
|
||||
|
|
|
@ -8,12 +8,14 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.models.agent.BehaviorBriefModel;
|
||||
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
|
||||
import org.bench4q.share.models.master.MonitorModel;
|
||||
import org.bench4q.share.models.master.RunningScriptModel;
|
||||
import org.bench4q.share.models.master.ScriptHandleModel;
|
||||
import org.bench4q.share.models.master.TestPlanModel;
|
||||
import org.bench4q.share.models.master.TestPlanResultModel;
|
||||
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;
|
||||
import org.bench4q.share.models.master.TestScriptConfig;
|
||||
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
|
||||
|
@ -117,8 +119,14 @@ public class TestPlanService {
|
|||
|
||||
public List<BehaviorStatusCodeResultModel> getAllBehaviorStatusCodeResultModels(
|
||||
String accessToken, String testPlanId) {
|
||||
List<ScriptHandleModel> scriptList = this.getTestPlanMessager()
|
||||
.getRunningTestInfo(accessToken, testPlanId).getScripts();
|
||||
TestPlanResultModel testPlanResultModel = this.getTestPlanMessager()
|
||||
.getRunningTestInfo(accessToken, testPlanId);
|
||||
if (testPlanResultModel == null) {
|
||||
Logger.getLogger(this.getClass()).info(
|
||||
"testPlan is null:" + testPlanId);
|
||||
return null;
|
||||
}
|
||||
List<ScriptHandleModel> scriptList = testPlanResultModel.getScripts();
|
||||
if (scriptList == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -139,11 +147,11 @@ public class TestPlanService {
|
|||
ScriptBehaviorsBriefModel scriptBehaviorsBriefModel) {
|
||||
List<BehaviorStatusCodeResultModel> behaviorStatusCodeResultModels = new ArrayList<BehaviorStatusCodeResultModel>();
|
||||
if (scriptBehaviorsBriefModel == null
|
||||
|| scriptBehaviorsBriefModel.getTestBehaviorsBriefModel() == null) {
|
||||
|| scriptBehaviorsBriefModel.getBehaviorBriefModels() == null) {
|
||||
return behaviorStatusCodeResultModels;
|
||||
}
|
||||
for (BehaviorBriefModel behaviorBriefModel : scriptBehaviorsBriefModel
|
||||
.getTestBehaviorsBriefModel().getBehaviorBriefModels()) {
|
||||
.getBehaviorBriefModels()) {
|
||||
|
||||
if (behaviorBriefModel.getDetailStatusCodeResultModels() != null)
|
||||
behaviorStatusCodeResultModels.addAll(behaviorBriefModel
|
||||
|
|
|
@ -179,10 +179,13 @@ body {
|
|||
<script src="script/testResult/behaviorAndPage.js"></script>
|
||||
<script src="script/testResult/highChartTheme.js"></script>
|
||||
<script src="script/testResult/tree.js"></script>
|
||||
<script src="lib/HashMap/HashMap.js"></script>
|
||||
<script src="script/testResult/graphSelectorTree.js"></script>
|
||||
<script src="script/testResult/graphSelector.js"></script>
|
||||
<script src="script/testResult/pieChart.js"></script>
|
||||
<script src="script/testResult/result-load.js"></script>
|
||||
<script src="script/testResult/pageResult.js"></script>
|
||||
<script src="script/testResult/behaviorResult.js"></script>
|
||||
<script src="script/testResult/resultNew.js"></script>
|
||||
</fmt:bundle>
|
||||
</body>
|
||||
|
|
|
@ -7,117 +7,6 @@ $('.dataTable').dataTable({
|
|||
},
|
||||
"bDestroy" : true
|
||||
});
|
||||
// get script list in running test plan------------------------------------
|
||||
|
||||
function getScriptList(testPlanId) {
|
||||
var scriptList = new Array();
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : testPlanId + "/runningInfo",
|
||||
dataType : "json",
|
||||
async : false,
|
||||
success : function(data) {
|
||||
if(!data.success){
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
else data=data.testPlan;
|
||||
if (data.scriptIds.length <= 0)
|
||||
return null;
|
||||
// for ( var i = 0; i < data.scriptIdNameMap.length; i++) {
|
||||
// scriptList.push(data.scriptIdNameMap[i]);
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
return scriptList;
|
||||
|
||||
}
|
||||
// page-----------------------------------------------------------
|
||||
|
||||
var PageResult = function() {
|
||||
this.result = new Array();
|
||||
this.intevalTime = 5000;
|
||||
this.header = new Array("page", "scriptName", "countFromBegin",
|
||||
"minResponseTimeFromBegin", "maxResponseTimeFromBegin",
|
||||
"averageResponseTimeThisTime", "latestResponseTime");
|
||||
this.table = $("#page").dataTable();
|
||||
|
||||
};
|
||||
PageResult.prototype.addResultToTable = function() {
|
||||
this.table.fnClearTable();
|
||||
var result = this.result;
|
||||
for ( var i = 0; i < result.length; i++) {
|
||||
var row = extractRowDataActionBefore(result[i], this.header, null);
|
||||
this.table.fnAddData(row);
|
||||
}
|
||||
loadItems.pageResult=true;
|
||||
|
||||
};
|
||||
var PageResultModel = function(page, scriptPageBriefModel, scriptName) {
|
||||
this.page = page;
|
||||
this.countFromBegin = scriptPageBriefModel.countFromBegin;
|
||||
this.minResponseTimeFromBegin = scriptPageBriefModel.minResponseTimeFromBegin;
|
||||
this.maxResponseTimeFromBegin = scriptPageBriefModel.maxResponseTimeFromBegin;
|
||||
this.averageResponseTimeThisTime = scriptPageBriefModel.averageResponseTimeThisTime;
|
||||
this.latestResponseTime = scriptPageBriefModel.latestResponseTime;
|
||||
this.scriptName = scriptName;
|
||||
};
|
||||
|
||||
PageResult.prototype.getResult = function(testPlanId, scriptList) {
|
||||
var pageResult = this;
|
||||
var finishedCount = 0;
|
||||
var count=0;
|
||||
var intervalId = setInterval(function() {
|
||||
count++;
|
||||
pageResult.addResultToTable();
|
||||
if (finishedCount >= scriptList.length) {
|
||||
clearInterval(intervalId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (scriptList.length == 0) {
|
||||
clearInterval(intervalId);
|
||||
return;
|
||||
}
|
||||
pageResult.result = [];
|
||||
finishedCount = 0;
|
||||
for ( var i = 0; i < scriptList.length; i++) {
|
||||
pageResult.getSinglePageResult(pageResult, intervalId,
|
||||
finishedCount, scriptList[i]);
|
||||
}
|
||||
if (testStatus == "Complete" && count == 2) {
|
||||
clearInterval(intervalId);
|
||||
return;
|
||||
}
|
||||
}, this.intevalTime);
|
||||
|
||||
};
|
||||
PageResult.prototype.getSinglePageResult = function(pageResult, intervalId,
|
||||
finishedCount, script) {
|
||||
var urlPath = [ testPlanId, "script", script.id, "page" ];
|
||||
var url = generateUrl(urlPath);
|
||||
$.post(url, {}, function(data) {
|
||||
if(!data.success){
|
||||
clearInterval(intervalId);
|
||||
return;
|
||||
}
|
||||
data = data.result;
|
||||
var scriptPagesFinished = true;
|
||||
for ( var i = 0; i < data.length; i++) {
|
||||
pageResult.result = $.merge(pageResult.result,
|
||||
[ new PageResultModel("page" + i, data[i],
|
||||
script.name) ]);
|
||||
if (!data[i].finished)
|
||||
scriptPagesFinished = false;
|
||||
|
||||
}
|
||||
if (scriptPagesFinished)
|
||||
finishedCount++;
|
||||
|
||||
}, "json");
|
||||
};
|
||||
|
||||
// Behavior-------------------------------------------------------
|
||||
var BehaviorResult = function() {
|
||||
this.behaviors = new Array();
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
function Behavior() {
|
||||
this.addButton = "<img src='images/add.png' alt='details' title='details' class='show-detail-picture'>";
|
||||
this.deleteButton = "<img src='images/add.png' alt='details' title='details' class='detail-picture'>";
|
||||
this.loadBehaviorResults = function(testPlanId, scripts) {
|
||||
var table = $("#url").dataTable();
|
||||
var map = new HashMap();
|
||||
var behavior = this;
|
||||
var intervalId = setInterval(function() {
|
||||
|
||||
for ( var i = 0; i < scripts.length; i++) {
|
||||
|
||||
if (map.get(scripts[i].name) != null
|
||||
&& map.get(scripts[i].name).finished == true) {
|
||||
continue;
|
||||
}
|
||||
var url = "/" + testPlanId + "/" + scripts[i].scriptId
|
||||
+ "/behaviors";
|
||||
behavior.getBehaviorResult(url, map, scripts[i].scriptName);
|
||||
}
|
||||
|
||||
behavior.insertDataToTable(table, map);
|
||||
// can refactor an a function to all script result
|
||||
var scriptsFinished = 0;
|
||||
for ( var i = 0; i < scripts.length; i++) {
|
||||
if (map.get(scripts[i].scriptName) != null
|
||||
&& map.get(scripts[i].scriptName).finished == true) {
|
||||
scriptsFinished++;
|
||||
}
|
||||
}
|
||||
if (scriptsFinished == scripts.length) {
|
||||
clearInterval(intervalId);
|
||||
return;
|
||||
}
|
||||
}, 10000);
|
||||
|
||||
}
|
||||
this.getBehaviorResult = function(url, map, scriptName) {
|
||||
$.post(url, {}, function(data) {
|
||||
if (!data.success) {
|
||||
return;
|
||||
}
|
||||
data = data.behaviors;
|
||||
map.put(scriptName, data);
|
||||
}, "json");
|
||||
}
|
||||
this.insertDataToTable = function(table, map) {
|
||||
|
||||
table.fnClearTable();
|
||||
for ( var k = 0; k < map.length(); k++) {
|
||||
var names = map.getKeys();
|
||||
var behaviors = map.get(names[k]).behaviorBriefModels;
|
||||
if (behaviors == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for ( var j = 0; j < behaviors.length; j++) {
|
||||
var data = behaviors[j];
|
||||
var row = table.fnAddData([ this.addButton, data.behaviorUrl,
|
||||
names[k], data.totalCount, data.successfulCount ]);
|
||||
var tr = table.fnSettings().aoData[row[0]].nTr;
|
||||
var detailTr = this.createDetailTr(data);
|
||||
detailTr.insertAfter($(tr));
|
||||
}
|
||||
}
|
||||
this.addEvent();
|
||||
}
|
||||
|
||||
this.createDetailTr = function(behaviorData) {
|
||||
|
||||
var tr = $("<tr></tr>");
|
||||
var td = $("<td></td>");
|
||||
td.append(this.createDetailTable(behaviorData));
|
||||
tr.append(td);
|
||||
tr.hide();
|
||||
return tr;
|
||||
|
||||
}
|
||||
|
||||
this.createDetailTable = function(behaviorData) {
|
||||
var theader = [ "url", "statusCode", "count", "contentLength",
|
||||
"minResponseTime", "maxResponseTime",
|
||||
"totalResponseTimeThisTime" ];
|
||||
var table = $("<table></table>");
|
||||
var url = behaviorData.url;
|
||||
var detailDatas = behaviorData.detailStatusCodeResultModels;
|
||||
table.addClass("innerTable");
|
||||
var thead = $("<thead></thead>");
|
||||
var tr = $("<tr></tr>");
|
||||
for ( var i = 0; i < theader.length; i++) {
|
||||
tr.append("<th>" + theader[i] + "</th>");
|
||||
}
|
||||
thead.append(tr);
|
||||
table.append(thead);
|
||||
var tbody = $("<tbody></tbody>");
|
||||
table.append(tbody);
|
||||
for ( var i = 0; i < detailDatas.length; i++) {
|
||||
var tr = this.createDetailRow(detailDatas[i], url, theader)
|
||||
tbody.append(tr);
|
||||
|
||||
}
|
||||
return table;
|
||||
}
|
||||
this.createDetailRow = function(detailData, url, theader) {
|
||||
|
||||
var tr = $("<tr></tr>");
|
||||
var dataArray = extractRowDataActionBefore(detailData, theader, null);
|
||||
dataArray[0] = url;
|
||||
for ( var i = 0; i < dataArray.length; i++) {
|
||||
var td = $("<td></td>");
|
||||
td.html(dataArray[i]);
|
||||
tr.append(td);
|
||||
}
|
||||
return tr;
|
||||
}
|
||||
|
||||
this.addEvent = function() {
|
||||
var behavior = this;
|
||||
$(".show-detail-picture").click(function() {
|
||||
if (this.parentNode != null) {
|
||||
var td = $(this.parentNode);
|
||||
var tr = $(this.parentNode.parentNode).next();
|
||||
tr.show();
|
||||
td.html(behavior.deleteButton);
|
||||
behavior.addEvent();
|
||||
}
|
||||
});
|
||||
$(".delete-detail-picture")
|
||||
.click(
|
||||
function() {
|
||||
if (this.parentNode != null) {
|
||||
var td = $(this.parentNode);
|
||||
var tr = $(this.parentNode.parentNode).next();
|
||||
tr.hide();
|
||||
td.html("");
|
||||
td.html(behavior.addButton);
|
||||
behavior.addEvent();
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
;
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
function loadPageResult(testPlanId, scripts) {
|
||||
var table = $("#page").dataTable();
|
||||
var map = new HashMap();
|
||||
var intervalId = setInterval(function() {
|
||||
|
||||
for ( var i = 0; i < scripts.length; i++) {
|
||||
|
||||
if (map.get(scripts[i].name) != null
|
||||
&& map.get(scripts[i].name).finished == true) {
|
||||
continue;
|
||||
}
|
||||
var url = "/" + testPlanId + "/" + scripts[i].scriptId + "/page";
|
||||
getPagesResult(url, map, scripts[i].scriptName);
|
||||
}
|
||||
insertDataToTable(table, map)
|
||||
var scriptsFinished = 0;
|
||||
for ( var i = 0; i < scripts.length; i++) {
|
||||
if (map.get(scripts[i].scriptName) != null
|
||||
&& map.get(scripts[i].scriptName).finished == true) {
|
||||
scriptsFinished++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (scriptsFinished == scripts.length) {
|
||||
clearInterval(intervalId);
|
||||
return;
|
||||
}
|
||||
}, 7000);
|
||||
|
||||
}
|
||||
function getPagesResult(url, map, scriptName) {
|
||||
|
||||
$.post(url, {}, function(data) {
|
||||
if (!data.success) {
|
||||
return;
|
||||
}
|
||||
data = data.pages;
|
||||
map.put(scriptName, data);
|
||||
}, "json");
|
||||
}
|
||||
|
||||
function insertDataToTable(table, map) {
|
||||
|
||||
table.fnClearTable();
|
||||
for ( var k = 0; k < map.length(); k++) {
|
||||
var names = map.getKeys();
|
||||
for ( var j = 0; j < map.get(names[k]).scriptPageBriefModels.length; j++) {
|
||||
var data = map.get(names[k]).scriptPageBriefModels[j];
|
||||
var page = "Page" + j;
|
||||
table
|
||||
.fnAddData([ page, names[k], data.countFromBegin,
|
||||
data.minResponseTimeFromBegin,
|
||||
data.maxResponseTimeFromBegin,
|
||||
data.averageResponseTimeThisTime,
|
||||
data.latestResponseTime ]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -2,24 +2,28 @@ var loadItems = new loadItems();
|
|||
var testStatus;
|
||||
|
||||
$(function() {
|
||||
var testPlanId=getvars()['testPlanId'];
|
||||
var testPlan=getTestInfo(testPlanId);
|
||||
// getTestBrief();
|
||||
var tree=getResultTree(testPlanId);
|
||||
var testPlanId = getvars()['testPlanId'];
|
||||
var testPlan = getTestInfo(testPlanId);
|
||||
// getTestBrief();
|
||||
loadPageResult(testPlanId, testPlan.scripts);
|
||||
|
||||
var behavior=new Behavior();
|
||||
behavior.loadBehaviorResults(testPlanId, testPlan.scripts);
|
||||
var tree = getResultTree(testPlanId);
|
||||
var chart = new Chart();
|
||||
chart.createChart($("#chart"));
|
||||
var chartSelector = createChartSelector(tree, chart,
|
||||
getShowTreePathValues(tree));
|
||||
chartSelector.initChart();
|
||||
chartSelector.initChart();
|
||||
graphButtonListener(chartSelector);
|
||||
var behaviorResult = new BehaviorResult();
|
||||
behaviorResult.getResult(testPlanId, getScriptList(testPlanId));
|
||||
var pageResult = new PageResult();
|
||||
pageResult.getResult(testPlanId, getScriptList(testPlanId));
|
||||
// var behaviorResult = new BehaviorResult();
|
||||
// behaviorResult.getResult(testPlanId, getScriptList(testPlanId));
|
||||
// // var pageResult = new PageResult();
|
||||
// pageResult.getResult(testPlanId, getScriptList(testPlanId));
|
||||
var urlContentTypeDistribution = new UrlContentTypeDistribution(
|
||||
"url-distribution", testPlanId);
|
||||
});
|
||||
function getTestInfo( testPlanId){
|
||||
function getTestInfo(testPlanId) {
|
||||
var testPlan;
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
|
@ -30,46 +34,12 @@ function getTestInfo( testPlanId){
|
|||
if (!data.success) {
|
||||
alert("no such testPlan!")
|
||||
return;
|
||||
} else{
|
||||
testPlan = data.testPlan;
|
||||
} else {
|
||||
testPlan = data.testPlan;
|
||||
}
|
||||
}
|
||||
});
|
||||
return testPlan;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//$(document).ready(
|
||||
// function() {
|
||||
// testPlanId = getvars()['testPlanId'];
|
||||
// if (!getTestPlanStatus(testPlanId))
|
||||
// return;
|
||||
// getTestBrief(testPlanId);
|
||||
// var tree = getResultInfoTree(testPlanId);
|
||||
// var replaceArray = createUrlReplaceArray(testPlanId);
|
||||
// doProgress();
|
||||
// var chart = new Chart();
|
||||
// chart.createChart($("#chart"));
|
||||
// var chartSelector = createChartSelector(tree, chart,
|
||||
// getShowTreePathValues(tree));
|
||||
// chartSelector.initChart(getShowTreePathValues(tree), this);
|
||||
// graphButtonListener(chartSelector);
|
||||
// var behaviorResult = new BehaviorResult();
|
||||
// behaviorResult.getResult(testPlanId, getScriptList(testPlanId));
|
||||
// var pageResult = new PageResult();
|
||||
// pageResult.getResult(testPlanId, getScriptList(testPlanId));
|
||||
// var urlContentTypeDistribution = new UrlContentTypeDistribution(
|
||||
// "url-distribution", testPlanId);
|
||||
// });
|
||||
|
||||
function replace(keyArray, replaceArray) {
|
||||
for ( var i = 0; i < keyArray.length; i++) {
|
||||
for ( var j = 0; j < replaceArray.length; j++) {
|
||||
if (keyArray[i] == replaceArray[j].oldWord)
|
||||
keyArray[i] = replaceArray[j].newWord;
|
||||
}
|
||||
}
|
||||
return testPlan;
|
||||
}
|
||||
|
||||
function graphButtonListener(chartSelector) {
|
||||
|
@ -138,32 +108,6 @@ var ReplaceNode = function(oldWord, newWord) {
|
|||
this.oldWord = oldWord;
|
||||
this.newWord = newWord;
|
||||
};
|
||||
// function createUrlReplaceArray(testPlanId) {
|
||||
// var replaceArray = new Array();
|
||||
// $.ajax({
|
||||
// type : "POST",
|
||||
// /* url : "/" + testPlanId + "/mapInfo", */
|
||||
// url : testPlanId + "/mapInfo",
|
||||
// dataType : "json",
|
||||
// async : false,
|
||||
// success : function(data) {
|
||||
// if (!data.success) {
|
||||
// alert(data.failedMessage);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// else
|
||||
// data = data.data;
|
||||
// for ( var key in data) {
|
||||
// var replaceNode = new ReplaceNode(key, data[key]);
|
||||
// replaceArray.push(replaceNode);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// return replaceArray;
|
||||
//
|
||||
// }
|
||||
|
||||
function getvars() {
|
||||
var vars = [], hash;
|
||||
|
|
Loading…
Reference in New Issue