by XDK
30. January 2014 11:37
Explanation:
A command line tool that only removes the attachments. It does not touch the test runs, which contain the pass/fail data. So, running Test Attachment Cleaner will not impact the record of the test runs.
You need to Test Attachment Cleaner if you:
- Do manual test runs and want to delete attachments without deleting the test runs
- Do automated test runs and want to delete attachment for builds which have been deleted already, but the build definition’s retention policy was not set to delete “test results” (because this is turned off by default)
You do not need the Test Attachment Cleaner if you:
- Have automated test runs triggered by a build, and you have configured the build definition’s retention policy to delete “test results” (which is not set by default)
- Delete the Test Runs manually (as this deletes the attachments)
SQL Query to get the attachment type associated with the team project.
Select projects.ProjectName, SUBSTRING(attachments.filename,
len(attachments.filename)-CHARINDEX('.',REVERSE(attachments.filename))+2,999) as Extension, sum(f.compressedlength)/1024/1024 as SizeInMB
From tbl_Attachment as attachments
INNER JOIN tbl_File as f on attachments.TfsFileId=f.fileid
INNER JOIN tbl_TestRun as tr on attachments.TestRunId = tr.TestRunId
INNER JOIN tbl_Project as projects on tr.ProjectId = projects.ProjectId
Group by projects.ProjectName, SUBSTRING(attachments.filename,len(attachments.filename)-CHARINDEX('.',REVERSE(attachments.filename))+2,999)
Order by sum(f.compressedlength) desc
Download Attachment Cleaner
Command to preview the attachments before delete
tcmpt attachmentcleanup /collection
:TfsUrl
/teamproject
:TeamProjectName
/settingsfile
:SettingsFile
/outputfile
:<Output dir>
/teamproject
.log
/mode
:
preview
Command to delete the attachments
tcmpt attachmentcleanup /collection
:TfsUrl
/teamproject
:TeamProjectName
/settingsfile
:SettingsFile
/outputfile:<Output dir>
/teamproject
.log
Sample settingsfile
<DeletionCriteria>
<TestRun/>
<Attachment>
<SizeInMB GreaterThan="50"/>
</Attachment>
<LinkedBugs>
<Excludestate="New"/>
<Excludestate="Committed"/>
<Excludestate="Approved"/>
</LinkedBugs>
</DeletionCriteria>