System.OutOfMemoryException
PROBLEM
My data driven test has hundreds or thousands of iterations. It fails during execution with one the following errors:
EXCEPTION! (see below)
Outer Exception Type: System.OutOfMemoryException
Message: Exception of type 'System.OutOfMemoryException' was thrown.Error attempting to execute a Test As Step. Details:
System.OutOfMemoryException: Out of memory.
SOLUTION
A test with that many iterations is very likely to encounter memory issues deep into execution. To combat this, use the ReuseAppWindow feature available in the Test Properties. This defines the number of iterations to reuse the browser window for a single test.
By default, zero keeps the same application open during the entire data driven test. Increasing that number can help to improve memory and performance. For example, a value of 50 causes the browser/app to close and reopen after every 50 iterations.
PROBLEM
When executing a test in Internet Explorer 9 on a Windows 7 32-bit or Windows XP machine, ArtOfTest.Runner exits unexpectedly, displaying this error:
- EXCEPTION! (see below)
Outer Exception Type: System.OutOfMemoryException
Message: Exception of type 'System.OutOfMemoryException' was thrown.
However, there is sufficient available system memory.
SOLUTION
This error is caused by the Microsoft UI Automation framework, which Test Studio uses to monitor dialogs. To avoid it, enable the DisableDialogMonitoring Test Property or Test List Setting. Note: this will prevent your test from handling dialogs.