简体   繁体   English

编码的UI测试一起运行时无法正常运行

[英]Coded UI Tests not running properly when run together

I have a bat files that executes the coded ui tests . 我有一个执行编码的ui测试的bat文件。 The problem is these tests run properly when run separately one after another. 问题在于,当这些测试一个接一个地运行时,这些测试可以正常运行。 ie comment the 30 odd test cases in the ordered test except one and run the batch file. 例如,在订购的测试中注释掉30个奇怪的测试用例(其中一个除外)并运行批处理文件。 It will pass that test case. 它将通过该测试用例。 But if I uncomment all these test cases and run it together one after another it fails. 但是,如果我取消所有这些测试用例的注释,然后一次又一次地运行它,它将失败。 What might be the possible cause of this error. 可能是此错误的原因。 Please help. 请帮忙。 I have been going with this for almost one week and i have spent loads of hours. 我已经进行了将近一个星期的时间,并且花费了数小时的时间。

I have this problem once. 我曾经有这个问题。 Maybe your test dependent on another test, maybe your first test is deleting data and after that second test trying to get data that deleted, another solution is try to comment test one by one and run together you will cath test that causing problem Hope helps! 也许您的测试依赖于另一个测试,也许您的第一个测试正在删除数据,而在第二个测试之后试图获取已删除的数据,另一个解决方案是尝试逐个注释测试并一起运行,您将测试引起问题的希望,希望对您有所帮助!

Perhaps tests are dependent on each other. 也许测试是相互依赖的。 If they are reading/writing from/to files, that's definitely something to look out for. 如果他们正在读/写文件,那绝对是要注意的事情。 Also, remember that the constructor is called once for the entire test class. 另外,请记住,整个测试类都会一次调用构造函数。 (Similarly, inline variable definitions are called once for the entire test class). (类似地,对于整个测试类,一次调用内联变量定义)。 Of course [ClassInitialize] will also only be run once for all tests. 当然,[ClassInitialize]对于所有测试也只会运行一次。 If all of that logic is moved into [TestInitialize], I would expect your problem to be resolved. 如果所有这些逻辑都移到[TestInitialize]中,则希望您的问题得到解决。

I had this problem when I was using a static class to hold an instance of the UI Map. 我在使用静态类保存UI Map实例时遇到了这个问题。

Here is the solution: 解决方法如下:

[TestInitialize]
      public void Init()
      {
         AppManager.ResetUIMap();
}

Then: 然后:

public static void ResetUIMap()
      {
         _map = new UIMap();
      }

You can't run coded UI test concurrently on the same machine, since they interact with the UI. 您无法在同一台计算机上同时运行编码的UI测试,因为它们会与UI交互。 Run them on multiple machines to run in parallel or create some VMs etc. 在多台计算机上运行它们以并行运行或创建一些VM等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 协同编码的UI测试 - Collaborative Coded UI tests 运行编码的UI测试时控制台未出现 - Console not appearing when running Coded UI test 使用 Resharper/NUnit 运行 Coded UI 测试将找不到 Silverlight 组件 - Running Coded UI tests with Resharper/NUnit will not locate Silverlight components 运行测试的彩色圆圈未出现在Visual Studio编码的UI测试中 - Colourful circles that run tests not appearing on Visual Studio Coded UI Test 手动更改编码的ui测试 - manually change coded ui tests 如何在运行Coded UI时解析当前目录 - How to resolve Current Directory when running Coded UI 一起运行时单元测试超时,单独运行时成功吗? - Unit Tests timeout when run together, succeed when run individually? 当隐藏的控件在编码的UI测试中显示在UI中时,如何使它们成为记录隐藏控件? - How can I make record hidden controls when they become visible in UI in coded UI tests? VS2012编码的UI测试:无法运行。 参考,所需路径? - VS2012 Coded UI Tests: can't run. References, path required? 是否可以在不必通过远程桌面连接的情况下运行编码的UI测试? - Is it possible to run Coded UI tests without having to connect via remote desktop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM