Reputation: 511
I am running coded UI test cases in agent machine through MTM. And for each run the test results gets generated in controller machine as you can see in the screenshot below.
As you can see that each run generates above two folders in controller AppData > local > VSTQT > QTController > run_number_folder folder
I need only Results folder and I want to delete the Deployment folder after each run in finished.
Is there a way to do it?
Note : I am using Test Agent and Test Controller 2013 Update 5
Upvotes: 0
Views: 2802
Reputation: 2176
Since you are running a coded UI test you could have some piece of code at the end that would find your deployment directory and delete it. As it shows you know your user and until QTController your path will be always the same, so you just have to find the deployment directory under that and remove it.
If you are running your tests from a build/release, you could add a powershell script after the test to delete your deployment directory.
To find the directory:
string[] dirs = Directory.GetDirectories(@"c:\users\user_name\appdata\local\vseqt\qtcontroller\", "deployment", System.IO.SearchOption.AllDirectories);
foreach(string dir in dirs)
{
Directory.Delete(dir);
}
You could define your retention policie for the results as well. Please see https://learn.microsoft.com/en-us/vsts/manual-test/getting-started/how-long-to-keep-test-results?view=vsts
Upvotes: -1
Reputation: 14038
Within the code of the tests, the TestContext
which is used by all Coded UI tests contains several directory fields. The DeploymentDirectory
field appears to be the one you need.
I do not think you can delete this directory and all its contents in one go because, as you write in a comment, it will be open and in use by part of the test suite. You should be able to scan through its files and subdirectories and delete most of them one by one, skipping over any that are already in use.
Another possibility is to create a cleanup script that will be called from the "Setup and cleanup scripts" part of the .testsettings
file in the solution. As above, some parts may not delete as they are already in use.
Upvotes: 3