Merge branch 'master' of https://github.com/lostcharlie/Bench4Q
This commit is contained in:
commit
88cc32a8fc
|
@ -9,18 +9,18 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
@XmlRootElement(name = "batch")
|
||||
public class BatchModel {
|
||||
private int Id;
|
||||
private int id;
|
||||
private int parentId;
|
||||
private int childId;
|
||||
private List<BehaviorModel> behaviors = new ArrayList<BehaviorModel>();
|
||||
|
||||
@XmlElement
|
||||
public int getId() {
|
||||
return Id;
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
Id = id;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
@ -209,17 +210,18 @@ public class ScriptController extends BaseController {
|
|||
operateScriptServerResponseModel.getFailCauseString());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("submitScriptCreated/{scriptName}")
|
||||
@RequestMapping(value="submitScriptCreated/{scriptName}")
|
||||
@ResponseBody
|
||||
public Map<String, Object> submitScriptCreated(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
// @RequestBody ScenarioModel scenarioModel,
|
||||
@RequestBody RunScenarioModel runScenarioModel,
|
||||
@RequestParam String runScenarioModelStr,
|
||||
@PathVariable String scriptName,
|
||||
@RequestParam(required = false) MultipartFile[] paramFiles) {
|
||||
|
||||
@RequestParam(required = false) MultipartFile[] paramFiles
|
||||
) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Gson gson = new Gson();
|
||||
RunScenarioModel runScenarioModel = gson.fromJson(runScenarioModelStr, RunScenarioModel.class);
|
||||
|
||||
// RunScenarioModel runScenarioModel = this.getScriptService()
|
||||
// .createRunScenarioModel(scenarioModel.getUsePlugins(),
|
||||
// scenarioModel.getBehaviors());
|
||||
|
|
|
@ -1 +1 @@
|
|||
masterAddress=133.133.2.100:8901
|
||||
masterAddress=127.0.0.1:8901
|
|
@ -204,5 +204,6 @@ staticTip=The static resources contains:js,css,jpeg,gif,png files.
|
|||
timeTipe=The Think time refers the time between tow behaviors.
|
||||
startServer=start server to generate a script or upload a script to server
|
||||
testExecuteTime=Execute Time
|
||||
|
||||
startServerFail=Fail to start record server:
|
||||
startServerFail=Fail to start record server:
|
||||
stopTestPlan=Stop Test
|
||||
stop=Stop
|
|
@ -206,3 +206,5 @@ staticTip=\u9759\u6001\u8D44\u6E90\u4E3B\u8981\u662F\u6307:js,css,jpeg,gif,png\u
|
|||
timeTip=\u601D\u8003\u65F6\u95F4\u6307\u7684\u662F\u7528\u6237\u4E24\u4E2A\u8FDE\u7EED\u884C\u4E3A\u4E4B\u95F4\u7684\u95F4\u9694\u65F6\u95F4
|
||||
startServer=\u70B9\u51FB\u542F\u52A8\u670D\u52A1\u5F55\u5236\u811A\u672C\u6216\u8005\u4E0A\u4F20\u811A\u672C\u6587\u4EF6
|
||||
testExecuteTime=\u6267\u884C\u65F6\u95F4
|
||||
stopTestPlan=\u505C\u6B62\u6D4B\u8BD5
|
||||
stop=\u505C\u6B62
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<link href="lib/jquery/css/jquery-ui-1.10.4.css" rel="stylesheet">
|
||||
<link href='css/scriptEditor.css' rel='stylesheet'>
|
||||
<link rel="shortcut icon" href="images/bench4q.png">
|
||||
<link rel="stylesheet" href="css/style.min.css" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
@ -217,6 +218,7 @@
|
|||
<script src="lib/bootstrap/js/bootstrap-modal.js"></script>
|
||||
<script src="lib/chrisma/js/jquery.cookie.js"></script>
|
||||
<script src="lib/chrisma/js/theme.js"></script>
|
||||
<script src="lib/other/jstree.min.js"></script>
|
||||
<script src="http://cdn.alloyui.com/2.5.0/aui/aui-min.js"></script>
|
||||
|
||||
<script src="lib/HashMap/HashMap.js"></script>
|
||||
|
@ -228,7 +230,7 @@
|
|||
<script src="script/editor/behavior.js"></script>
|
||||
<script src="script/editor/usePlugin.js"></script>
|
||||
<script src="script/editor/submitScript.js"></script>
|
||||
|
||||
<script src="script/editor/jstreeFactory.js"></script>
|
||||
|
||||
<script src="script/Share/getUrlVars.js"></script>
|
||||
<script src="script/ScriptEditor/scriptEditor.js"></script>
|
||||
|
|
|
@ -44,4 +44,5 @@ recordScript=Record Script
|
|||
stopRecord=The script recording has been stopped, please input the script name and save it.
|
||||
saveScriptSuccess=Save successfully.
|
||||
saveScriptFail=Fail to save script.
|
||||
plugin_jsp_addPage=Add Page
|
||||
plugin_jsp_addPage=Add Page
|
||||
stopTestPlan_fail=Stop running test plan fail
|
|
@ -40,4 +40,5 @@ recordScript=\u5F55\u5236\u811A\u672C
|
|||
stopRecord=\u505C\u6B62\u811A\u672C\u5F55\u5236\uFF0C\u8BF7\u8F93\u5165\u811A\u672C\u540D\u79F0\uFF0C\u4FDD\u5B58\u811A\u672C
|
||||
saveScriptSuccess=\u4FDD\u5B58\u6210\u529F\u3002
|
||||
saveScriptFail=\u4FDD\u5B58\u811A\u672C\u5931\u8D25
|
||||
plugin_jsp_addPage=\u52A0\u9875
|
||||
plugin_jsp_addPage=\u52A0\u9875
|
||||
stopTestPlan_fail=\u505C\u6B62\u8FD0\u884C\u6D4B\u8BD5\u8BA1\u5212\u5931\u8D25
|
|
@ -67,23 +67,28 @@ body {
|
|||
</div> --%>
|
||||
</div>
|
||||
<div class="row-fluid testHeader" id="test">
|
||||
<div class="span4 span-brief">
|
||||
<div class="span3 span-brief">
|
||||
<fmt:message key="result-testStatus" />
|
||||
<br> <br>
|
||||
<div id="status"></div>
|
||||
</div>
|
||||
<div class="span4 span-brief">
|
||||
<div class="span3 span-brief">
|
||||
<fmt:message key="result-vuser" />
|
||||
<br> <br>
|
||||
<div>
|
||||
<span id="vu"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span4 span-brief-last">
|
||||
<div class="span3 span-brief">
|
||||
<fmt:message key="result-request" />
|
||||
<br> <br>
|
||||
<div id="request"></div>
|
||||
</div>
|
||||
<div class="span3 span-brief-last">
|
||||
<fmt:message key="stopTestPlan" />
|
||||
<br> <br>
|
||||
<button type="button" class="btn btn-primary " id="stop-testplan"><fmt:message key="stop" /></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<h4 class="pull-left"><fmt:message key="result-charts" /></h4>
|
||||
|
|
|
@ -25,18 +25,45 @@ function getScriptObject(scriptId) {
|
|||
//
|
||||
|
||||
// collectScriptData = new CollectScriptData(usePlugin, behavior);
|
||||
|
||||
var index = 0;
|
||||
var index2 = 0;
|
||||
var pos;
|
||||
var indexId = 1;
|
||||
var usePlugin = new UsePlugin();
|
||||
usePlugin.getPluginList();
|
||||
|
||||
//init plugin
|
||||
scriptObj.usePlugins;
|
||||
while(index < scriptObj.usePlugins.length){
|
||||
jstreeCreateNode("usePluginList",scriptObj.usePlugins[index].name,scriptObj.usePlugins[index].name,scriptObj.usePlugins[index].id,"after");
|
||||
index++;
|
||||
}
|
||||
jstreeSelectNode("usePluginList", scriptObj.usePlugins[0].id);
|
||||
|
||||
//init page, batch, behavior
|
||||
scriptObj.pages;
|
||||
index = 0;
|
||||
jstreeCreateNode("useBehaviorList","page","page",indexId,"after");
|
||||
jstreeSelectNode("useBehaviorList", indexId);
|
||||
indexId++;
|
||||
while(index < scriptObj.pages.length){ //create_node("batch")
|
||||
pos = "last";
|
||||
jstreeCreateNode("useBehaviorList","batch","batch",indexId,pos);
|
||||
jstreeSelectNode("useBehaviorList", indexId);
|
||||
indexId++;
|
||||
var batches = scriptObj.pages[index].batches;
|
||||
var index2 = 0;
|
||||
while(index2 < batches.length){ //create_node("behavior")
|
||||
jstreeCreateNode("useBehaviorList",batches[index2].behaviors[0].name,batches[index2].behaviors[0].name,indexId,pos);
|
||||
jstreeSelectNode("useBehaviorList", indexId);
|
||||
pos = "after";
|
||||
indexId++;
|
||||
index2++;
|
||||
if(index2 == batches.length)
|
||||
jstreeSelectNode("useBehaviorList", 1);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
jstreeSelectNode("useBehaviorList", 1);
|
||||
var behavior = new Behavior();
|
||||
|
||||
}
|
||||
|
||||
}, "json");
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@ $(function() {
|
|||
// usePlugin.getPluginList();
|
||||
|
||||
$("#submitScript").click(function() {
|
||||
var pages = behavior.getPages();
|
||||
submitScript(pages);
|
||||
var plugins = usePlugin.getPlugins();
|
||||
var pages = usePlugin.getPages();
|
||||
submitScript(pages,plugins);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -28,32 +28,29 @@ function CollectScriptData(behavior) {
|
|||
// this.behaviors = behaviors;
|
||||
//}
|
||||
|
||||
function submitScript(pages) {
|
||||
// var usePlugins = scriptDataModel.usePlugin;
|
||||
// var behaviors = collectScriptData.collectBehavior();
|
||||
// var scenarioModel = new ScenarioModel(usePlugins, behaviors);
|
||||
// if (usePlugins.length == 0 || behaviors.length == 0) {
|
||||
// return;
|
||||
// }
|
||||
function submitScript(pages,usePlugins) {
|
||||
|
||||
|
||||
var scriptName = $("#scriptName").val();
|
||||
if (scriptName == undefined || scriptName == "") {
|
||||
alert("need a script name!")
|
||||
return;
|
||||
}
|
||||
// $.ajax({
|
||||
// type : "POST",
|
||||
// url : "submitScriptCreated" + "/" + scriptName,
|
||||
// data : JSON.stringify(scenarioModel),
|
||||
var runScenarioModel = new RunScenarioModel(0,usePlugins,new Array(),pages);
|
||||
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "submitScriptCreated" + "/" + scriptName,
|
||||
data :{runScenarioModelStr: JSON.stringify(runScenarioModel)},//JSON.stringify(runScenarioModel),
|
||||
// dataType : "json",
|
||||
// contentType : "application/json",
|
||||
// success : function(data) {
|
||||
// if (!data.success) {
|
||||
// return;
|
||||
// } else {
|
||||
// alert("success");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
success : function(data) {
|
||||
if (!data.success) {
|
||||
return;
|
||||
} else {
|
||||
alert("success");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -8,9 +8,8 @@ function UsePluginViewModel(id, name) {
|
|||
function UsePlugin(behaviorListContainerId) {
|
||||
var containerId = "usePluginList";
|
||||
// var usePlugin = this;
|
||||
|
||||
var behavior = new Behavior(this,"useBehaviorList");
|
||||
|
||||
var paramDataCollector = new DataCollector();
|
||||
|
||||
var index = 1;
|
||||
var usePluginEditorMap = new HashMap();
|
||||
|
@ -180,12 +179,10 @@ function UsePlugin(behaviorListContainerId) {
|
|||
for ( var i = 0; i < keys.length; i++) {
|
||||
var id = keys[i];
|
||||
var usePluginViewModel = map.get(id);
|
||||
|
||||
var usePluginContainer = usePluginEditorMap
|
||||
.get(id);
|
||||
var params = this.paramDataCollector.getUnitParams($(
|
||||
var usePluginContainer = usePluginEditorMap.get(id);
|
||||
var params = paramDataCollector.getUnitParams($(
|
||||
usePluginContainer).find(".editor"));
|
||||
usePlugins.push(new UsePluginModel(usePluginViewModel.id, pluginName, params));
|
||||
usePlugins.push(new UsePluginModel(usePluginViewModel.id, usePluginViewModel.name,usePluginViewModel.nickName, params));
|
||||
}
|
||||
return usePlugins;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
var loadItems = new loadItems();
|
||||
|
||||
$(function() {
|
||||
var testPlanId = getvars()['testPlanId'];
|
||||
var testPlan = getTestInfo(testPlanId);
|
||||
var testPlanRunId = getvars()['testPlanId'];
|
||||
var testPlan = getTestInfo(testPlanRunId);
|
||||
$("#testplanName").html(testPlan.testPlanName);
|
||||
$("#createTime").html(new Date(testPlan.createDateTime));
|
||||
$("#testTime").html(testPlan.executeTime)
|
||||
if (!(testPlan.currentStatus == "InRunning" || testPlan.currentStatus == "Complete")) {
|
||||
return;
|
||||
}
|
||||
getTestBrief(testPlanId);
|
||||
getTestBrief(testPlanRunId);
|
||||
|
||||
// doProgress();
|
||||
var pageResult = new PageResult();
|
||||
pageResult.loadPageResult(testPlanId, testPlan.scripts);
|
||||
pageResult.loadPageResult(testPlanRunId, testPlan.scripts);
|
||||
var behavior = new Behavior();
|
||||
behavior.loadBehaviorResults(testPlanId, testPlan.scripts);
|
||||
var tree = getResultTree(testPlanId);
|
||||
behavior.loadBehaviorResults(testPlanRunId, testPlan.scripts);
|
||||
var tree = getResultTree(testPlanRunId);
|
||||
if (tree == null) {
|
||||
alert($.i18n.prop('test-error'));
|
||||
}
|
||||
|
@ -27,6 +27,25 @@ $(function() {
|
|||
getShowTreePathValues(tree));
|
||||
chartSelector.initChart();
|
||||
graphButtonListener(chartSelector);
|
||||
|
||||
$("#stop-testplan").click(function() {
|
||||
if ($("#status").attr("status") == "InRunning") {
|
||||
$.post("stop/" + testPlanRunId, {}, function(data) {
|
||||
if (data.success) {
|
||||
$('#status').attr("status", "Complete");
|
||||
var testStatus = testStatusMap("Complete");
|
||||
$('#status').html("<h4>" + testStatus + '</h4>');
|
||||
} else {
|
||||
alert($.i18n("stopTestPlan_fail"));
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
function getTestInfo(testPlanId) {
|
||||
var testPlan;
|
||||
|
@ -124,4 +143,4 @@ function getvars() {
|
|||
vars[hash[0]] = hash[1];
|
||||
}
|
||||
return vars;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
masterAddress=127.0.0.1:6000
|
||||
masterAddress=127.0.0.1:8901
|
Loading…
Reference in New Issue