MSTest - How to limit test result folders

2020-02-27 07:34发布

问题:

Every time an MSTest runs it creates a new time stamped folder inside of TestResults. This can result in many files/folders that take up hard drive space.

Is there a way to configure MSTest to overwrite the contents of the TestResults folder so that is only contains results from the most recent run?

回答1:

You can limit the number of stored test-runs to 1, which should meet your requirements.

MSDN have an article on how to achieve this:

  • In Visual Studio, click Options on the Tools menu.
  • The Options dialog box appears.
  • Expand Test Tools or Web Performance Test Tools and click Test Execution
  • Under Test Results Management, select the number of test runs to keep.
  • Click OK.