gpt4 book ai didi

tfs - Microsoft Team Foundation Server Express 2012 - 如何清理 tbl_TestResult(旧测试结果)

转载 作者:行者123 更新时间:2023-12-03 03:47:42 27 4
gpt4 key购买 nike

我已经安装了 Microsoft Team Foundation Server Express 2012。

表 tbl_TestResult 占用了 7000 MB 的数据库空间。

我尝试查找有关如何清理此表的信息,但找不到方法。

当我想将新文件 checkin TFS 时,出现错误 TF30042:数据库已满...

在 Visul Studio 上,我删除了所有可见的测试,但 tbl_TestResult 的大小仍然只减少了很少。

谁能向我解释如何以正确的方式清理所有测试结果?

最佳答案

我正在使用 TFS 客户端 API 删除旧的测试运行。这是一些示例代码:

TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("http://tfs2012:8080/tfs/DefaultCollection/"));

TestManagementService testManagementService = tpc.GetService<TestManagementService>();

ITestManagementTeamProject teamProject = testManagementService.GetTeamProject("MyProject");

int totalRuns = teamProject.TestRuns.Count("SELECT * FROM TestRun");

// Limit by date, so the query doesn't take too long.
string query = "SELECT * FROM TestRun WHERE CreationDate < '2013/07/01'";
int numTotalToDelete = teamProject.TestRuns.Count(query);

if (numTotalToDelete == 0) { return; }

// Only delete 500 at a time, to give SQL Server time to breathe (don't ask).
var runsToDelete = teamProject.TestRuns.Query(query, false)
.Take(500);
teamProject.TestRuns.Delete(runsToDelete);

查询语法来自这里:http://blogs.msdn.com/b/duat_le/archive/2010/02/25/wiql-for-test.aspx

关于tfs - Microsoft Team Foundation Server Express 2012 - 如何清理 tbl_TestResult(旧测试结果),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25532160/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com