<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>nipun-jain</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/nipun-jain/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/nipun-jain/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:50:33 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Restore deleted test suite from backup database</title>
      <link>https://docs.microsoft.com/archive/blogs/nipun-jain/restore-deleted-test-suite-from-backup-database</link>
      <pubDate>Sun, 07 Jul 2013 03:35:00 GMT</pubDate>
      <dc:creator><![CDATA[nipun jain]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nipun-jain/2013/07/07/restore-deleted-test-suite-from-backup-database/</guid>
      <description><![CDATA[In this post, I am going to talk about how to restore a deleted test suite. For deleting a test...]]></description>
      <content:encoded><![CDATA[<p>In this post, I am going to talk about how to restore a deleted test suite. For deleting a test suite, a user needs to have <a title="manage test plan permission" href="https://msdn.microsoft.com/en-us/library/vstudio/ms252587.aspx#Area">manage test plan permission</a> on the area path of the&nbsp;test plan.&nbsp;This is quite restrictive permission but still we have heard numerous instances where users have deleted the suites knowingly/unknowingly which have caused data loss for an&nbsp;organization. We don't have an automated way to restore&nbsp;deleted suites .&nbsp;You can restore it manually though by creating a replica of the deleted suite&nbsp;if you have a back up copy of the TFS database (both configuration and project collection) which contains the deleted test suite. Normally almost all the companies enforce to take backups so finding a backup having the deleted suite should not be very difficult.</p>
<p><span style="color: #800000;"><strong>Note: Querying or modifying SQL tables directly is not a supported option and can change in future versions.</strong></span> Steps mentioned below are provided &ldquo;as-is&rdquo; to help in identifying the deleted suites and recovering the deleted data from backups.</p>
<p>Now let us go through the steps you should perform to recover your deleted suite.</p>
<ul>
<li><strong>Identify the deleted suites</strong>: -&nbsp;&nbsp;All the list of deleted test suites can be retrieved by running following query on project collection database:</li>
</ul>
<p style="padding-left: 30px;"><em>Select * from tbl_auditlog where ObjectType = 11</em></p>
<p style="padding-left: 30px;">Sample output- --</p>
<p style="padding-left: 30px;"><em>PartitionId AuditId&nbsp;DateModified&nbsp;Action&nbsp;ObjectType&nbsp;ObjectID1&nbsp;ObjectID2&nbsp;ProjectId&nbsp;AuditIdentity</em></p>
<p style="padding-left: 30px;">Over here <em>DateModfied</em> represents the date of deletion, <em>ObjectID1</em> represents the deleted test suite Id and <em>AuditIdentity</em> is the TFS identity of user who deleted the suite.</p>
<p style="padding-left: 30px;">For finding more information about the user who deleted the suite, run the following query on TFS configuration database</p>
<p style="padding-left: 30px;"><em>select * from tbl_Identity where Id = 'AuditIdentity'&nbsp;</em></p>
<p style="padding-left: 30px;">You can also find deleted suites by following the steps&nbsp;mentioned <a title="here" href="https://blogs.msdn.com/b/visualstudioalm/archive/2012/07/25/when-did-my-test-plan-get-deleted-who-deleted-my-test-suite-test-run.aspx">here</a>.</p>
<ul>
<li><strong>Find the backup&nbsp;database and attach it to SQL Server</strong>: - &nbsp;</li>
</ul>
<p style="padding-left: 30px;">Since this test suite is deleted, current database would not hold any information of this suite. You need to find out the latest back up database in which the test suite was present. You already know the date of deletion of test suite, so pick up a database which was backed up&nbsp;just before the deletion date of suite.</p>
<ul>
<li><strong>Find basic information about deleted suite from backup &amp; create the new one using MTM: - </strong></li>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get basic information of test suite like <em>ProjectName,&nbsp;TestPlanId, ParentSuiteId, Title,&nbsp;SuiteType, Query, RequirementId</em> from the backup database using this SQL query:</p>
<p style="padding-left: 60px;"><em>select p.ProjectName, s.*</em><br /><em>from tbl_suite s</em><br /><em>join&nbsp; tbl_Project p</em><br /><em>on s.ProjectId = p.ProjectId</em><br /><em>where s.SuiteId = @deletedSuiteId&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- deletedSuiteId is the identity of deleted suite</em></p>
<p style="padding-left: 30px;">Now in Microsoft Test Manager, connect to the&nbsp;project having its name as <em>ProjectName. </em>Find the test plan with its&nbsp;id as <em>TestPlanId</em> and connect to it. <em>ParentSuiteId</em> refers to the identity of the suite under which new suite needs to be created.</p>
<p style="padding-left: 30px;">Suites can be of three different types which are as follows:</p>
<p style="padding-left: 30px;"><em>Type</em>&nbsp;1 represents Query Based Suite.</p>
<p style="padding-left: 30px;"><em>Type</em>&nbsp;2 represents Static Suite</p>
<p style="padding-left: 30px;"><em>Type</em>&nbsp;3&nbsp; represents Requirement Based Suite.</p>
<p style="padding-left: 30px;">&nbsp;If the <em>Type</em>&nbsp;is for&nbsp;Query Based Suite then create a query based suite. Set its&nbsp;query as&nbsp;<em>Query</em>&nbsp;and title&nbsp;as <em>Title</em></p>
<p style="padding-left: 30px;">&nbsp;If the <em>Type</em>&nbsp;is for Requirement Based Suite then&nbsp;create a requirement based suite. Select a requirement&nbsp;with id as&nbsp;<em>RequirementId.</em></p>
<p style="padding-left: 30px;">&nbsp;If the <em>Type</em>&nbsp;is for Static Suite, just create a new static&nbsp;suite and set its title&nbsp;as <em>Title.</em></p>
<ul>
<li><strong>Find configuration of deleted suite from backup &amp; assign them to new suite: - </strong></li>
</ul>
<p style="padding-left: 30px;">Find the configuration of the deleted suite using the following query on backup database</p>
<p style="padding-left: 30px;"><em>select inheritConfigs </em><br /><em>from tbl_suite w</em><br /><em>here SuiteId = @deletedSuiteId</em></p>
<p style="padding-left: 30px;">If <em>inheritConfigs</em> flag is 1 then just set "Inherit configurations from parent test suite" in Default Configurations window from Microsoft Test Manager otherwise we need to retrieve configurations for this test suite.You can retrieve them using the following query on backup database.</p>
<p style="padding-left: 60px;"><em>select c.* from tbl_SuiteConfiguration s</em><br /><em>join tbl_Configuration c</em><br /><em>on s.ConfigurationId = c.ConfigurationId</em><br /><em>where s.SuiteId = @deletedSuiteId</em></p>
<p style="padding-left: 30px;">Now apply the configurations using MTM on the newly created suite.</p>
<ul>
<li>&nbsp;<strong>Find the test cases associated with deleted suite from the backup and add them to&nbsp;new suite: - </strong></li>
</ul>
<p style="padding-left: 30px;">Find the test cases associated with deleted suite by using the below SQL query on the backup database:</p>
<p style="padding-left: 60px;"><em>select e.TestCaseId</em><br /><em>from tbl_SuiteEntry e</em><br /><em>where e.SuiteId = @deletedSuiteId</em><br /><em>and e.TestCaseId &lt;&gt; 0</em></p>
<p style="padding-left: 30px;">Add these test cases to the new test suite using Microsoft Test Manager</p>
<p style="padding-left: 30px;">&nbsp;Note: - This step is&nbsp;not applicable for Query based suite.</p>
<ul>
<li><strong>Find the results associated with the deleted suite and bulk mark them in new suite: - </strong></li>
</ul>
<p style="padding-left: 30px;">Find the test results associated with deleted test suite by using the below SQL query on the backup database</p>
<p style="padding-left: 60px;"><em>select c.Name, r.*</em><br /><em>from tbl_TestResult r</em><br /><em>join tbl_Point p</em><br /><em>on r.TestPointId = p.PointId</em><br /><em>&nbsp;and r.TestRunId = p.LastTestRunId</em><br /><em>&nbsp;and r.TestResultId = p.LastTestResultId</em><br /><em>join tbl_configuration c</em><br /><em>on c.ConfigurationId = r.ConfigurationId</em><br /><em>where p.SuiteId = @deletedSuiteId</em></p>
<p style="padding-left: 30px;">The above query returns the last result for a given test case/configuration combination.&nbsp;Using the outcome field from for the above query, you should bulk mark the&nbsp;corresponding tests in your new suite. For example if <em>OutCome</em> value is 2 for a test case/configuration&nbsp;name&nbsp;, you should mark the corresponding test as passed.</p>
<p style="padding-left: 30px;">Possible list of test outcome is as follows:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; None = 1,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Passed = 2,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Failed = 3,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Inconclusive = 4,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Timeout = 5,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Aborted = 6,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Blocked = 7,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NotExecuted = 8,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Warning = 9,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Error = 10,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NotApplicable = 11,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Paused = 12,</p>
<p style="padding-left: 30px;">Note: - This step is optional and is applicable only for manual test cases.</p>
<p>Congratulations !! You have restored your suite now. Enjoy !!</p>]]></content:encoded>
    </item>
    <item>
      <title>Cleanup redundant test impact data</title>
      <link>https://docs.microsoft.com/archive/blogs/nipun-jain/cleanup-redundant-test-impact-data</link>
      <pubDate>Sat, 27 Oct 2012 01:08:13 GMT</pubDate>
      <dc:creator><![CDATA[nipun jain]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/nipun-jain/2012/10/27/cleanup-redundant-test-impact-data/</guid>
      <description><![CDATA[In this article, I am going to talk about how to get rid of redundant test impact data from Team...]]></description>
      <content:encoded><![CDATA[<p>In this article, I am going to talk about how to get rid of redundant test impact data from Team Foundation Server. The test impact data is mostly&nbsp;stored in tbl_testcodesignature table in project collection database. This table essentially keeps the mapping between a testresult and the impacted CodeSignatures from the product dll. Normally a testcase will use lot of codesingnatures from product so the size of this&nbsp;table grows up in million of rows. Test impact data is associated with a test run which in turn is associated with a particular build. So when a build gets deleted, all the runs associated with a build also gets deleted. As part of run deletion , we delete test impact data from tbl_testCodeSignature table also. So one approach to keep check on size of test impact data table is to delete redundant builds which have lot of test impact data.</p>
<p>You can find the pattern of data associated with tbl_testcodesignature table with builds by running &nbsp;the following query. This sql query gives an idea of how much rows of&nbsp; tbl_testCodeSignature table belongs to a particular build. This query is for dev10 TFS and should be run at project collection database.</p>
<p>select tbc.BuildUri, COUNT(*)</p>
<p>from tbl_TestCodeSignature tc</p>
<p>join tbl_TestRun tr</p>
<p>on tc.TestRunId = tr.TestRunId</p>
<p>join tbl_buildconfiguration tbc</p>
<p>on tbc.BuildConfigurationId<br />= tr.BuildConfigurationId</p>
<p>group by tbc.BuildUri</p>
<p>&nbsp;</p>
<p>If there are unused builds with large amount of test impact data, you can delete those builds using TfsBuild.exe commandline. Make sure you specify testresults as part of build deletion option or you can specify ALL.</p>]]></content:encoded>
    </item>
  </channel>
</rss>