从备份数据库恢复已删除的测试套件(TFS 2017 Update1) [英] Restore deleted test suite from backup database (TFS 2017 Update1 )

查看:149
本文介绍了从备份数据库恢复已删除的测试套件(TFS 2017 Update1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的TFS管理员在2013年7月7日发现了这篇旧文章(以下网址)。可能有人指出我们关于如何"从备份数据库恢复已删除的测试套件"的最新指示的方向。对于TFS 2017更新1 请?

Our TFS admin found this old article (URL below) from 7/7/2013. May someone point us in the direction of the latest instruction on how to "Restore deleted test suite from backup database" for TFS 2017 update 1 please?

执行一些代码后,我发现一些TSQL已经过时了。

After executing some of the code I found some TSQL to be obsolete.

- https://blogs.msdn.microsoft.com/nipun-jain/2013/07/07/restore-deleted-test-suite-from- backup-database /

-- https://blogs.msdn.microsoft.com/nipun-jain/2013/07/07/restore-deleted-test-suite-from-backup-database/

- https://social.msdn.microsoft.com/Forums/vstudio/en-US/a59f196e-b2ed-4b0f-aa2a-5aeb31b24070/restoring-deleted -test-suite-in-tfsmtm?forum = vsmantest

-- https://social.msdn.microsoft.com/Forums/vstudio/en-US/a59f196e-b2ed-4b0f-aa2a-5aeb31b24070/restoring-deleted-test-suite-in-tfsmtm?forum=vsmantest

- ********************* *********************************************

-- ******************************************************************

- 初级执行

- ************************** ****************************************

-- ******************************************************************

USE

[Tfs_IEHP项目]

GO

- SELECT * FROM [Tfs_IEHP Projects]。[dbo] .tbl_AuditLog WHERE ObjectType = 11 ORDER BY DateModified DESC --OBJECTid1代表删除的测试SUITID - 注意:已弃用使用TSQL低于

--SELECT * FROM [Tfs_IEHP Projects].[dbo].tbl_AuditLog WHERE ObjectType = 11 ORDER BY DateModified DESC --OBJECTid1 REPRESENTS THE DELETED TEST SUITID -- NOTE: DEPRECATED USE TSQL BELOW

SELECT

* FROM [Tfs_IEHP
项目]
[dbo] [tbl_Suite]
WHERE IsDeleted
=
ORDER BY LastUpdated
DESC - AND 
SuiteId IN(7164,4886,7162,7141,7138)

*FROM[Tfs_IEHP Projects].[dbo].[tbl_Suite] WHEREIsDeleted =ORDERBYLastUpdated DESC--AND  SuiteId IN (7164, 4886, 7162, 7141, 7138)

USE

Tfs_TFSDBConfiguration

GO

- 查找IDENTITY

--FIND IDENTITY

- SELECT * FROM [Tfs_TFSDBConfiguration]。[dbo]。[tbl_Identity] WHERE Id ='1134AB04 -2825-48D7-AF43-798E4DE3B0C3'

--SELECT * FROM [Tfs_TFSDBConfiguration].[dbo].[tbl_Identity] WHERE Id = '1134AB04-2825-48D7-AF43-798E4DE3B0C3'

- SELECT * FROM [Tfs_TFSDBConfiguration]。[dbo]。[tbl_Identity]

--SELECT * FROM [Tfs_TFSDBConfiguration].[dbo].[tbl_Identity]

- ********************************** ********************************

-- ******************************************************************

- 执行备份恢复数据库

-- EXECUTE ON BACKUP RESTORED DB

- ************************************* *****************************

-- ******************************************************************

USE

[Tfs_IEHP Projects]

GO

DECLARE

@ deletedSuiteId
as int = '2182'

@deletedSuiteId asint='2182'

- 选择p.ProjectName,s。*

--select p.ProjectName, s.*

- 来自tbl_suite s

--from tbl_suite s

- join  tbl_Project p

--join  tbl_Project p

- on s.ProjectId = p.ProjectId

--on s.ProjectId = p.ProjectId

- 其中s.SuiteId = @deletedSuiteId

--where s.SuiteId = @deletedSuiteId

- 从tbl_suite中选择inheritConfigs - 其中SuiteId = @deletedSuiteId - - 注意!现在同样TBL_SUITE --DEPRECATE

--select inheritConfigs  from tbl_suite --where SuiteId = @deletedSuiteId -- -- NOTE! NOW IN SAME TBL_SUITE --DEPRECATE

选择

c 。* from tbl_SuiteConfiguration
s

c.*fromtbl_SuiteConfiguration s

加入

tbl_Configuration c

s ConfigurationId
= c ConfigurationId

s.ConfigurationId =c.ConfigurationId

其中

s SuiteId
= @ deletedSuiteId

s.SuiteId =@deletedSuiteId

选择

e TestCaseId

e.TestCaseId

来自

tbl_SuiteEntry e

其中

e SuiteId
= @ deletedSuiteId

e.SuiteId =@deletedSuiteId

e TestCaseId
<> 0

e.TestCaseId <>0

选择

c 名称 r 。*

c.Name,r.*

来自

tbl_TestResult r

加入

tbl_Point p

r TestPointId
= p PointId

r.TestPointId =p.PointId

r TestRunId
= p LastTestRunId

andr.TestRunId =p.LastTestRunId

r TestResultId
= p LastTestResultId

andr.TestResultId =p.LastTestResultId

加入

tbl_configuration c

c ConfigurationId
= r ConfigurationId

c.ConfigurationId =r.ConfigurationId

其中

p SuiteId
= @ deletedSuiteId

p.SuiteId =@deletedSuiteId

非常有必要!

推荐答案

您好RFDZ,

Hi RFDZ,

感谢您在此发帖。

您仍然可以使用上述博客恢复测试用例,但在TFS2017中略有不同,恢复测试套件更容易。你可以参考我的样本:

You could still use the above blog to recover the test case, but it is a little different in TFS2017, it is easier to recover test suite. You could refer to my sample:

1.使用以下查询查找所有直接删除的测试套件(您可以直接在数据库中运行查询,不需要在备份数据库中运行查询):

1. Use the following query to find out all the deleted test suite directly(You could run the query in the database directly, do not need to run the query in the backup databases):

SELECT [SuiteId]
      ,[PlanId]
      ,[ParentSuiteId]
      ,[Title]
      ,[Description]
      ,[Revision]
      ,[SuiteType]
      ,[Status]
      ,[InheritConfigs]
      ,[DeletionDate]
  FROM [Tfs_DefaultCollection].[dbo].[tbl_Suite] where DeletionDate is not null

然后你可以找到全部删除了测试套件,但现在tbl_Suite中没有项目行。作为一种变通方法,您可以在集合中的任何项目中编写查询,选择"Query Across Projects";如下图所示,
然后您可以根据区域和迭代找出测试计划和测试计划所属的项目:

Then you could find all the deleted the test suite, but there is no project row in the tbl_Suite now. As a workaround, you could write a query in any of the project in the collection, select "Query Across Projects" like the following picture, then you could find out the test plan and the project the test plan belongs to based on the Area and Iteration:

之后,创建一个新测试直接在测试计划下的套件。

After that, create a new test suite under the test plan directly.

2。运行以下查询以找出连接到测试套件的测试用例:

2. Run the following query to find out the test case connected to the test suite:

SELECT [SuiteId] ,[TestCaseId] FROM [Tfs_DefaultCollection].[dbo].[tbl_SuiteEntry] where SuiteId = 'DeletedsuiteID'

TFS不会删除测试下的测试用例套件甚至你删除了测试套件,所以在你找到测试用例之后,你只需要回到TFS网络访问>>添加现有的测试用例>>输入测试用例的ID:

TFS will not delete the test case under the test suite even you delete the test suite, so after you find out the test case, you just need to go back to TFS web access>>Add existing test case>>Input the ID of test case:

然后你也可以恢复之前连接到测试套件的测试用例。如果您有任何其他问题,请告诉我。

Then you could also recover the test case which connect to test suite before. Please let me know if you have any other problem.

最好的问候

Limitxiao Gao

Limitxiao Gao


这篇关于从备份数据库恢复已删除的测试套件(TFS 2017 Update1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆