Team System Developer Center >
Visual Studio Team System Forums
>
Visual Studio Team System - Testing
>
ClassCleanup times out when executing a batch file
ClassCleanup times out when executing a batch file
- Hi,I am attempting to restore an Oracle database back to it's previous state by using flashback recovery using the ClassCleanup attributeI have written a batch file + sql commands to properly restore the database. This has been tested in my command prompt numerous times without issuesI would normally put the restore as a cleanup script inside the test run, however I need to include a time to flashback the database to (set on the ClassInitialize)
try { ProcessStartInfo startInfo = new ProcessStartInfo(@"SomeProjectDirectory\flashback.bat"); startInfo.CreateNoWindow = false; startInfo.WindowStyle = ProcessWindowStyle.Normal; startInfo.ErrorDialog = true; startInfo.Arguments = Arguments; startInfo.UseShellExecute = true; Process batchExecute = new Process(); batchExecute.StartInfo = startInfo; batchExecute.Start(); batchExecute.WaitForExit(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); }The batch files is executed but the problem seems to be that the CleanUp method times out before it has finished executing.So far, I have tried:- Put breakpoints on points after the WaitForExit(), and none of them are hit.- Added a Timeout attribute to the ClassCleanup method with a large number but doesn't seem to help.- Moved the batch file into the TestCleanup and it worked without a problemSearching on the web came up with a similar problem but no solutionIs there a reason why this occurs?
All Replies
- Hello,
Are there any warning or error messages? As I know, you may create a new bat file which will execute flashback.bat with proper arguments, then choose setup and cleanup script tab in the .testrunconfig file, select the new created file as cleanup script.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com. - There are no warning or error messages. The test comes back successfulThe thought has occurred to me that I could create a new batch file during the ClassInitialize that could be run in the cleanup script. It isn't appropriate to me to build a workaround for something that should work but doesn't without any explanation why. If someone came back to me and stated it was a bug with Visual Studio, I could accept that and use whatever work around I needed to.Edit> It has also occurred to me that the cleanup script will only be run at the end of all my tests. The intention was to have the cleanup perform at the end of each class. Could work around this, however resolving the initial issue would be significantly better.


