Share via


Deleting old load test results

Load testers sometimes need to clean up old load test results from the VSTS load test results store. The following SQL script deletes all load test results older than two weeks (though the timeframe is easily changed).

If you have a lot of results, this could take a while to run. I would recommend that you do not run this script while a load test is running as we have seen this cause the load test to timeout while trying to write to the database.

-- This script deletes all load test run older than two weeks
-- To change the timeframe, change the number of days from 14 to the desired number

USE LoadTest
DECLARE @LoadTestRunId int
DECLARE OldLoadTestsCursor CURSOR FOR
    SELECT LoadTestRunId FROM LoadTestRun WHERE datediff(dd, StartTime, getdate()) > 14

OPEN OldLoadTestsCursor
FETCH NEXT FROM OldLoadTestsCursor INTO @LoadTestRunId

WHILE @@FETCH_STATUS = 0
BEGIN
    EXEC Prc_DeleteLoadTestRun @LoadTestRunId
    FETCH NEXT FROM OldLoadTestsCursor INTO @LoadTestRunId
END

CLOSE OldLoadTestsCursor
DEALLOCATE OldLoadTestsCursor

Comments

  • Anonymous
    February 21, 2006
    There’s been a lot of attention lately on Team Foundation Server as it gets ready to ship. But...
  • Anonymous
    February 22, 2006
    All tasks that should be performed on a regulary basis are listed here.

    Deleting old load test results (via...
  • Anonymous
    January 31, 2007
    All tasks that should be performed on a regulary basis are listed here. Deleting old load test results
  • Anonymous
    March 15, 2007
    Thanks you. Just what I needed.
  • Anonymous
    May 25, 2007
    hi,it gives error could not locate loadtest database in sysdatabases.sneh,smtripathi99@hotmail.com
  • Anonymous
    March 17, 2008
    Visual Studio Team System for Testers Content Index for Web Tests and Load Tests Getting Started Online
  • Anonymous
    February 23, 2009
    IS THE time taken is long ? seems for me it takes forever
  • Anonymous
    June 09, 2009
    PingBack from http://cellulitecreamsite.info/story.php?id=8612
  • Anonymous
    September 18, 2011
    Hi Bill.In the 'Open and Manage Load Test Results' window you can select multiple test results for export or removal, but for some reason the option to open them is disabled (VSTS2010 Ultimate).  How can I open multiple load test results then ?