0
votes

I'm working on CodedUI(VS2015) for testing a windows application. I have around 318 test cases that are executed using the Ordered test. The script will execute and show how many test cases failed or passed but for the last few executions, execution are blocked in between. Complete execution is not done and Out of memory exeption is shown in stack trace. Each time I execute script is stopped at different test cases.

This issue exists for all versions of the windows application now. Tried executing in 8GB as well as 16GB RAM configurations, still the issue was there.

Expected: Script should either pass or run.
Actual: Result29 Message:   Error calling Initialization method for test class
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

I am using ordered test for script execution and the scripts are failed in between. previously scripts were running properly.

Stacktrace: please find the stacktrace got after execution. I got many exceptions like this after the test run.

Result148 Name: 290- TC_747174_Cash_A_Check_DataValidation_CheckID_OnUsDetails_1 (cashacheck2) Result148 Outcome: Failed Result148 Duration: 0:00:00.0245286 Result148 StackTrace: at System.Threading.Thread.StartInternal(IPrincipal principal, StackCrawlMark& stackMark) at System.Threading.Thread.Start(StackCrawlMark& stackMark) at System.Threading.Thread.Start() at Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaWorker.StartWorkerThread() at Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaTechnologyManager.StartSession(Boolean recordingSession) at Microsoft.VisualStudio.TestTools.UITest.Framework.UITestPluginManager.<>c__DisplayClass1_0.b__0(UITechnologyManager manager) at System.Threading.Tasks.Parallel.<>c__DisplayClass42_0`2.b__1() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object ) Result148 Message: Error calling Initialization method for test class UltraDataAutomation.TestCases.CheckList_MemberTransactionsFeature: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

1
Try some memory profiling tool (Redgate memory profiler, etc.) to see what is consuming more. - Thangadurai
It would appear that some part of the tests are allocating memory but not releasing it. I would look at your test cases first, perhaps they are not releasing UiTestControl objects when test cases finish. - AdrianHHH
Do your tests use global (static) variables? Those act as roots that prevent the referenced objects from becoming collectable garbage. - Wim Coenen
BTW, the reason 8GB or 16GB doesn't make a difference is because CodedUI test code always runs in a 32-bit process. (Not to be confused with the process of the application under test itself, which is separate from the CodedUI test runner and can be 64-bit.) I believe 32-bit .NET processes can only use 2GB. Maybe a bit more but certainly less than 4GB. - Wim Coenen
1) Usable address space in your process is the important measure, not the amount of physical ram and 2) unhelpfully, there are a number of components (I'm looking at System.Drawing) that will throw OutOfMemory exceptions if they've exhausted their short list of "likely" error situations, so it may have nothing to do with memory/address space at all. Can you get a stack trace for that exception? - Damien_The_Unbeliever

1 Answers

0
votes

There can be many possible causes, for example maybe you're allocating memory inside loops and not freeing it up properly. Same problem can happen if you are opening many data connections and not closing/disposing them properly.