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
Within the code of the tests, the
TestContext
which is used by all Coded UI tests contains several directory fields. TheDeploymentDirectory
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.