<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="../../../CSS/bootstrap/bootstrap.min.css" rel="stylesheet" />
<!--如果有修改该配置文件,请修改"?"号后面的参数-->
<script src="../../../Scripts/config.js?v=1.1"></script>
<script src="../../../Scripts/Base64.js"></script>
<script src="../../../Scripts/jquery/jquery-1.10.2.min.js"></script>
<script src="../../../Scripts/bootstrap.min.js"></script>
<script src="../../../Scripts/jquery.form.js"></script>
<script type="text/javascript">
var url = "http://localhost";
$(function () {
//导出数据
$("#BtnExport").click(exportData);
$("#BtnCaseSuit").click(CaseSuit);
$("#BtnCaseSearch").click(CaseSearch);
$("#BtnWorkItemDetails").click(getWorkItemDetails);
$("#BtnUpdateTestCaseResult").click(updateTestCaseResult);
$("#BtnGetDetailsOfTestCase").click(GetDetailsOfTestCase);
}); //修改执行用例的测试结果
function updateTestCaseResult() {
var json = {
CollectionName: '项间需求2',
ProjectName: '项间需求项目2',
TestRunid: '',
TestCaseResultInfo: {
ComputerName: "",
FailureType: "",
FailureTypeId: "",
Priority: "",
State: "",
TestCaseRevision: "",
Comment: "此处为注释",
DateCompleted: "2016-5-9",
DateStarted: "2015-5-5",
ErrorMessage: "错误信息",
Outcome: ""
}
};
$.ajax({
type: "post",
url: "http://localhost:8080/TfsWebApi/api/TestDoCase/UpdateTestResult",
data: JSON.stringify(json),
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
alert(data);
}
});
}
//查询工作项详情
function getWorkItemDetails() {
$.ajax({
type: "post",
url: "http://localhost/TfsWebApi/api/WorkItem/GetDetailsOfWorkItem",
data: "{'collectionName':'项间需求2','projectName':'项间需求项目2',id:'218'}",
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
alert(data);
}
});
} //计划
function exportData() {
$.ajax({
type: "post",
url: "http://localhost/TfsWebApi/api/TestPlan/GetTestPlan",
data: "{'collectionName':'WX201512','projectName':'WX20151207'}",
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
var value = "";
$(eval(data)).each(function () {
value += "【id:" + this.id
+ "; name:" + this.name
+ "; Areapath:" + this.Areapath
+ "; Iteration:" + this.Iteration
+ "; Description:" + this.Description
+ "; StartDate:" + this.StartDate
+ "; EndTime:" + this.EndTime
+ "; Description:" + this.Description
+ ";Links:" + this.Links
+ ";State:" + this.State
+ "】<br/>";
});
$("#valuesshow").html(value);
}
});
} //根据测试计划查询测试套件
function CaseSuit() {
$.ajax({
type: "post",
url: "http://localhost:8080/TfsWebApi/api/TestSuit/GetTestSuitFromPlan",
data: "{'collectionName':'WX201512','projectName':'WX20151207','testPlanIds':'251,428,436'}",
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
var value = "";
$(eval(data)).each(function () {
value += "【planid:" + this.planId
+ "; id:" + this.id
+ "; title:" + this.Title
+ "; State:" + this.State
+ "; Description: " + this.Description
+ "】<br/>";
});
$("#valuesshow").html(value);
}
});
} //根据测试套件查询执行用例
function CaseSearch() {
$.ajax({
type: "post",
url: "http://localhost/TfsWebApi/api/TestDoCase/GetTestDoCaseFromSuit",
data: "{'collectionName':'WX201512','projectName':'WX20151207','testSuitids':'252,253,307','testPlanIds':'428,436'}",
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
var value = "";
$(eval(data)).each(function () {
value += "【planId:" + this.planId
+ "; planName:" + this.planName
+ "; suitId:" + this.suitId
+ "; suitName:" + this.suitName
+ "; testCaseId:" + this.testCaseId
+ "; testCaseName:" + this.testCaseName
+ "; testRunId:" + this.testRunId
+ "; testRunDateDue:" + this.testRunDateDue
+ "; testRunState:" + this.testRunState
+ "; testRunTime:" + this.testRunTime
+ "; testRunMan:" + this.testRunMan
+ "; buglinks:" + this.buglinks
+ "】<br/>";
});
$("#valuesshow").html(value);
}
});
} //查询用例详情
function GetDetailsOfTestCase() {
$.ajax({
type: "post",
url: "http://localhost:8080/TfsWebApi/api/TestCase/GetDetailsOfTestCase",
data: "{'collectionName':'项间需求2','projectName':'项间需求项目2','testCaseIds':'332,351,352,362,363'}",
contentType: "application/json;charsr=utf-8",
dataType: "json",
success: function (data) {
var json = jQuery.parseJSON(data);
var value = "";
$(json.data).each(function () {
value += "【TestCaseId:" + this.TestCaseId
+ "; TestPlanId:" + this.TestPlanId
+ "; TestPlanName:" + this.TestPlanName
+ "; Description:" + this.Description
+ "; AssignedTo:" + this.AssignedTo
+ "; AreaPath:" + this.AreaPath
+ "; IterationPath:" + this.IterationPath
+ "; State:" + this.State
+ "; Reason:" + this.Reason
+ "; TestEnvironment:" + this.TestEnvironment
+ "; AutomatedTestStorage:" + this.AutomatedTestStorage
+ "; AutomatedTestType:" + this.AutomatedTestType
+ "; Tested:" + this.Tested
+ "; Attachments:" + this.Attachments
+ "; AllLinks:" + this.AllLinks
+ "】<br/>";
});
$("#valuesshow").html(value);
}
});
} </script>
</head>
<body>
<div style="width:200px; margin:200px auto;"> <input id="BtnExport" type="button" value="查询测试计划 " class="btn btn-default btn-sm btn_style" /><br /><br />
<input id="BtnCaseSuit" type="button" value="查询测试套件" class="btn btn-default btn-sm btn_style" /><br /><br />
<input id="BtnCaseSearch" type="button" value="查询执行用例" class="btn btn-default btn-sm btn_style" /><br /><br />
<input id="BtnWorkItemDetails" type="button" value="查询工作项详情 " class="btn btn-default btn-sm btn_style" /><br />
<input id="BtnUpdateTestCaseResult" type="button" value="更新测试用例执行结果 " class="btn btn-default btn-sm btn_style" /><br /><br />
<input id="BtnGetDetailsOfTestCase" type="button" value="查询测试用例详情 " class="btn btn-default btn-sm btn_style" />
</div>
<div id="valuesshow"></div> </body>
</html>

8.ajax查询数据的更多相关文章

  1. ajax查询数据返回结果不变

    在使用流水号的时候,Google浏览器没有问题,但是IE有缓存,如果ajax请求的参数没有变化,那么就会返回缓存里的数据 解决方法:ajax请求的时候传值的参数设置一个时间戳就OK了(没什么特别意义, ...

  2. ajax查询数据的举例

    1.根据下拉框的值异步查询信息 HTML代码如下: <script> $(function(){ //页面载入时执行 $("#key").change(function ...

  3. jquery通过ajax查询数据动态添加到select

    function addSelectData() { //select的id为selectId //清空select中的数据 $("#selectId").empty(); $.a ...

  4. 查询数据过多页面反应慢引入缓存解决方案(Redis、H2)

      问题:原系统查询接口不支持分页也不可能加入分页支持,导致Ajax查询数据过多,返回数据达到2W多条记录时响应已经极慢,查询功能不要求数据实时性,页面反应速度极慢.体验不好:经排查是由于数据量过大导 ...

  5. ASP.NET 前端Ajax获取数据并刷新

    控制器中↓ /// <summary> /// 根据ID来进行展示数据 /// </summary> /// <param name="instru_id&qu ...

  6. 5月17 利用AJAX查询数据库

    利用AJAX查询数据 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// ...

  7. vue使用element Transfer 穿梭框实现ajax请求数据和自定义查询

    vue使用element Transfer 穿梭框实现ajax请求数据和自定义查询 基于element Transfer http://element-cn.eleme.io/#/zh-CN/comp ...

  8. 通过ajax GET方式查询数据,Django序列化objects

    点击“查找2”按钮,通过ajax GET方式进行查询数据,这样页面不需要整体刷新,之后清空tbody数据,将查询结果重新附加到tbody 前端html: <div class="box ...

  9. AC中保存数据与查询数据

    //保存数据 hui.ajax(function (ret, err) { }, url, {values: {t:"test",m:"Search",c:&q ...

随机推荐

  1. selenium测试(Java)--下拉框(二十一)

    例子: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title ...

  2. MongoDB状态查询:db.serverStatus()

    参见:http://www.2cto.com/database/201501/370191.html 基本信息 spock:PRIMARY>db.serverStatus() { "h ...

  3. WinInet 小例子

    #include <windows.h> #include <wininet.h> #include <string> #include <iostream& ...

  4. e640. 使一个组件可拖动

    This example demonstrates the code needed to make a component draggable. The object being transferre ...

  5. Linux jstack分析cpu占用100%

    背景: 运行测试程序后,top命令发现某个进程(pid)占用cpu达到100%.   查看哪个线程占用最多资源: ps mp pid -o THREAD,tid,命令查看这个进程下面的所有线程占用情况 ...

  6. Loadrunner 9.5_webservice(SOAP)性能测试

    WebService定义:Webservice是一种新的使用基于XML标准和协议来交换信息的WEB应用程序.是基于SOAP(简单对象访问协议)消息的应该协议,只是为WEB页面或可执行程序提供编程接口. ...

  7. JavaScript 取对象的值时用点和中括号的区别

    用点的时候 点后面是对象的真实属性名称, 用中括号的时候 中括号里面是变量或者字符串

  8. oracle中REF Cursor用法

    from:http://www.111cn.net/database/Oracle/42873.htm 1,什么是 REF游标 ? 动态关联结果集的临时对象.即在运行的时候动态决定执行查询. 2,RE ...

  9. kafka原理

    今天因为工作接触kafka,先说说kafka是干嘛的. kafka: 说简单点他就是一个基于分布式的消息发布-订阅系统. 然后再理解一些专有名词: Kafka 专用术语 Broker:Kafka 集群 ...

  10. 如何在HTML中播放flash

    随着html的风靡,改变了之前前端的许多条条框框,而video的出现使flash仿佛都要退出历史的舞台了,但是h5也会出现以下局限性,比如说,在一些不支持h5的浏览器上,此处省略一万只草泥马..... ...