如何使用CodedUI

时间:2019-01-02 05:08:13

标签: c# windows coded-ui-tests specflow ordered-test

我正在使用CodedUI(VS2015)来测试Windows应用程序。我有大约318个使用有序测试执行的测试用例。该脚本将执行并显示有多少个测试用例失败或通过,但是对于最后几个执行,执行之间被阻止。未完成完整的执行,Out of memory exeption显示在堆栈跟踪中。每次执行脚本时,我都会在不同的测试用例处停止操作。

现在所有版本的Windows应用程序都存在此问题。尝试在8GB和16GB RAM配置中执行,但问题仍然存在。

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.

我正在对脚本执行使用有序测试,并且脚本在两者之间失败。以前的脚本运行正常。

Stacktrace: 请找到执行后得到的stacktrace。在测试运行后,我遇到了很多类似的异常情况。

结果148名称:290- TC_747174_Cash_A_Check_DataValidation_CheckID_OnUsDetails_1(cashacheck2) 结果148结果:失败 结果148持续时间:0:00:00.0245286 结果148 StackTrace: 在System.Threading.Thread.StartInternal(IPrincipal主体,StackCrawlMark&stackMark)    在System.Threading.Thread.Start(StackCrawlMark&stackMark)    在System.Threading.Thread.Start()    在Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaWorker.StartWorkerThread()    在Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaTechnologyManager.StartSession(布尔记录会话)    在Microsoft.VisualStudio.TestTools.UITest.Framework.UITestPluginManager。<> c__DisplayClass1_0.b__0(UITechnologyManager管理器)    在System.Threading.Tasks.Parallel。<> c__DisplayClass42_0`2.b__1()    在System.Threading.Tasks.Task.InnerInvoke()    在System.Threading.Tasks.Task.InnerInvokeWithArg(任务childTask)    在System.Threading.Tasks.Task中。<> c__DisplayClass176_0.b__0(Object) Result148消息:为测试类UltraDataAutomation.TestCases.CheckList_MemberTransactionsFeature调用初始化方法时出错:System.OutOfMemoryException:引发了类型为'System.OutOfMemoryException'的异常。

1 个答案:

答案 0 :(得分:0)

可能有很多可能的原因,例如,您可能在循环内分配内存而没有正确释放它。如果您打开许多数据连接而未正确关闭/处置它们,可能会发生同样的问题。

相关问题