I have a 'suite' of VS2005 unit tests that attach a db as part of the initialization. Tests modify the db fairly substantially so need to revert it to a known state before each test run.
我有一个VS2005单元测试的“套件”,它将数据库作为初始化的一部分。测试会相当大地修改db,因此需要在每次测试运行之前将其恢复到已知状态。
I deploy the test db to the 'out' folder of each TestResult and attach it in the MyClassInitialize method.
我将测试数据库部署到每个TestResult的'out'文件夹中,并将其附加到MyClassInitialize方法中。
DB is fairly large so this uses up lots of space as more and more TestResults created.
数据库相当大,因此随着越来越多的TestResults创建,这会占用大量空间。
Is there any way from within Visual Studio to limit the maximum number of testresults stored? ie. stores a max of 5 + deletes oldest when hits 5?
在Visual Studio中是否有任何方法来限制存储的最大测试结果数?即。存储最多5个+删除最旧的命中5?
Regards,
Matt
3 个解决方案
#1
This works from VS2010 (from MSDN):
这适用于VS2010(来自MSDN):
To limit the number of stored test runs 1.In Visual Studio, click Options on the Tools menu.
限制存储的测试运行的数量1.在Visual Studio中,单击“工具”菜单上的“选项”。
The Options dialog box appears.
将出现“选项”对话框。
2.Expand Test Tools and click Test Execution.
2.展开“测试工具”,然后单击“测试执行”。
3.Under Test Results Management, select the number of test runs to keep.
3.在“测试结果管理”下,选择要保留的测试运行次数。
4.Click OK.
#2
As far as I can see, you cannot limit the number of test run results stored by Visual Studio.
据我所知,您不能限制Visual Studio存储的测试运行结果的数量。
#3
One could create a method that runs on test initialization that browses to the proper location, and just uses file manipulation to delete a certain number, however the method you're suggesting might cause issues if multiple users attempt to run the unit tests at the same time (depending on how your test environment is setup).
可以创建一个在测试初始化时运行的方法,该方法浏览到正确的位置,并且只使用文件操作来删除某个数字,但是如果多个用户尝试同时运行单元测试,那么您建议的方法可能会导致问题时间(取决于您的测试环境的设置方式)。
The method I generally use is to create a copy of the database in test initialization, then on test tear down to delete the copy that's being used we generally append a guid to the database name to ensure uniqueness. The biggest issue with this method is if you abort the tests during debug the Database never gets deleted.
我通常使用的方法是在测试初始化中创建数据库的副本,然后在测试中拆除以删除正在使用的副本我们通常会在数据库名称后附加一个guid以确保唯一性。此方法的最大问题是,如果在调试期间中止测试,则数据库永远不会被删除。
#1
This works from VS2010 (from MSDN):
这适用于VS2010(来自MSDN):
To limit the number of stored test runs 1.In Visual Studio, click Options on the Tools menu.
限制存储的测试运行的数量1.在Visual Studio中,单击“工具”菜单上的“选项”。
The Options dialog box appears.
将出现“选项”对话框。
2.Expand Test Tools and click Test Execution.
2.展开“测试工具”,然后单击“测试执行”。
3.Under Test Results Management, select the number of test runs to keep.
3.在“测试结果管理”下,选择要保留的测试运行次数。
4.Click OK.
#2
As far as I can see, you cannot limit the number of test run results stored by Visual Studio.
据我所知,您不能限制Visual Studio存储的测试运行结果的数量。
#3
One could create a method that runs on test initialization that browses to the proper location, and just uses file manipulation to delete a certain number, however the method you're suggesting might cause issues if multiple users attempt to run the unit tests at the same time (depending on how your test environment is setup).
可以创建一个在测试初始化时运行的方法,该方法浏览到正确的位置,并且只使用文件操作来删除某个数字,但是如果多个用户尝试同时运行单元测试,那么您建议的方法可能会导致问题时间(取决于您的测试环境的设置方式)。
The method I generally use is to create a copy of the database in test initialization, then on test tear down to delete the copy that's being used we generally append a guid to the database name to ensure uniqueness. The biggest issue with this method is if you abort the tests during debug the Database never gets deleted.
我通常使用的方法是在测试初始化中创建数据库的副本,然后在测试中拆除以删除正在使用的副本我们通常会在数据库名称后附加一个guid以确保唯一性。此方法的最大问题是,如果在调试期间中止测试,则数据库永远不会被删除。