Playback.initialize does not clean up cause playback error for STA

Cause :

The Coded UI Test is running in Single Thread Apartment (STA) mode of COM.  In this mode, all the playback calls should happen from the TestMethod thread only and UITestControl should not be shared across TestMethods.



Situation:

Create a test project  which contain several class - Unit Test Class and each class contain several test method.

In each test method, we define UIMaps related to different application and call UI to finish work flow.


If we want to run these test method, we have to do playback.initial for this class is not "CodedUI" class.

So, user have to initial placyback by itself.


So, in each test method, we should have these codes:


private static Boolean initializedByMe = false;

if (!Playback.IsInitialized)
            {
                Playback.Initialize();


                Playback.PlaybackSettings.MatchExactHierarchy = true;
                Playback.PlaybackSettings.SearchInMinimizedWindows = false;
                Playback.PlaybackSettings.ShouldSearchFailFast = true;
                Playback.PlaybackSettings.SkipSetPropertyVerification = false;
                Playback.PlaybackSettings.SearchInMinimizedWindows = false;


                initializedByMe = true;
            } 


After i add these and run again, then i match the problem that be mentioned at first of this article.

Do searching to fix this problem and found this article:

http://social.msdn.microsoft.com/Forums/en-US/vsautotest/thread/ea5a2bd0-dbae-4256-b8c3-25d6eb45257a/



Solution:

  After test method is finished, should clean playback. Then the later test method can reload UIMap and find exactly one on testing

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值