等待X ms System.OutOfMemoryException

时间:2019-04-05 05:17:22

标签: c# wpf mvvm white

我已经为该应用程序的功能之一实现了白色框架测试用例。 测试用例正在执行的功能类似于从应用程序的主屏幕,单击主屏幕上的按钮后,它将导航到另一个屏幕,然后在登录屏幕上,它将重复单击该按钮50次,以执行保存操作。数据和读取数据。

测试用例的要求是检查应用程序的可靠性,并且假设该测试用例要在用户输入的分钟内运行。

CoreAppXmlConfiguration.Instance.BusyTimeout的值=用户输入的执行时间,以分钟为单位* 60000 + 5000;

以下是测试用例的代码

[TestMethod]
public void TestcaseName()
{
  // Take memory snapshot
  Stopwatch sw = new Stopwatch(); // Stopwatch to compare time if it is equals 
                                  // or exceeds time enter by user.
  sw.Start();
  bool needToRepeate = true;
  While(needToRepeate)
  {
   // do white framework code which will execute functionality

   if(sw.Elapsed >= time enter by user in minutes)
   {
    needToRepeate = false;
    // Take memory snapshot
    sw.stop();
   }
  }
}

以下是完整的堆栈跟踪记录

TestStack.White.UIItems.UIActionException: Window didn't respond, after waiting for X ms ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Diagnostics.NtProcessInfoHelper.GetProcessInfos(IntPtr dataPtr)
at System.Diagnostics.NtProcessInfoHelper.GetProcessInfos()
at System.Diagnostics.ProcessManager.GetProcessInfos(String machineName)
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.get_Threads()
at MS.Internal.Automation.HwndProxyElementProvider.System.Windows.Automation.Provider.IWindowProvider.WaitForInputIdle(Int32 milliseconds)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at MS.Internal.Automation.UiaCoreApi.CheckError(Int32 hr)
at TestStack.White.UIItems.WindowItems.Window.WaitForWindow() in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\UIItems\WindowItems\Window.cs:line 223
at TestStack.White.UIItems.WindowItems.Window.WaitWhileBusy() in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\UIItems\WindowItems\Window.cs:line 184
--- End of inner exception stack trace ---
at TestStack.White.UIItems.WindowItems.Window.WaitWhileBusy() in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\UIItems\WindowItems\Window.cs:line 191
at TestStack.White.UIItems.Actions.Action.Handle(Window window) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\UIItems\Actions\Action.cs:line 17
at TestStack.White.UIItems.WindowItems.Window.ActionPerformed(Action action) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\UIItems\WindowItems\Window.cs:line 254
at TestStack.White.InputDevices.Mouse.ActionPerformed(ActionListener actionListener) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\InputDevices\Mouse.cs:line 190
at TestStack.White.InputDevices.Mouse.Click(Point point, ActionListener actionListener) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\InputDevices\Mouse.cs:line 185
at TestStack.White.UIItems.UIItem.PerformClick() in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\UIItems\UIItem.cs:line 265
at TestStack.White.UIItems.UIItem.PerformIfValid(Action action) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\UIItems\UIItem.cs:line 242
at TestStack.White.UIItems.UIItem.Click() in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\UIItems\UIItem.cs:line 231
at TestStack.White.Bricks.DelegateInvoker.VoidActionInvokerWrapper.Call(Object[] args) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\Bricks\DelegateInvoker.cs:line 309
at TestStack.White.Bricks.DynamicProxyInterceptors.Process(IInvocation invocation, CoreInterceptContext interceptedContext) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\Bricks\DynamicProxyInterceptors.cs:line 21
at TestStack.White.Interceptors.CoreInterceptor.Intercept(IInvocation invocation) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\Interceptors\CoreInterceptor.cs:line 31
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.ButtonProxy.Click()

实际结果: 连续运行测试用例7天时发生错误,它将在第3天中断,记录的错误是“等待X ms后窗口没有响应”。

其中X是用户输入的值,转换为毫秒。

预期结果: 它应该运行测试用例,没有任何错误。

我试图弄清楚为什么白色框架会抛出OutofMemory异常。

有人可以帮我吗

预先感谢

0 个答案:

没有答案