How to Run CodedUI TestMethod in customized thread

What i want to do?

control loops in main

{

create multiple threads to do testing.

thread-one will call "CodeUI Test Method" to simulate User's Actions.

thread-two will monitor the result produce by thread-one.

}


What is the problem?

When the thread-one is startup, whole process will stop at the code from UIMap.

Also means that Codes on UI does not be play during playback.


How to resolve it?

 After i do searching in MSDN, Gautam Goenka [MSFT]
Microsoft
(MSFT)
 answer my question:

1. There is no guarantee that all the tests will run in same thread (or for that matter even in same exe).
2. You can call recorded method in UI map from another methods too.  You need to ensure you have done Playback.Initialize() and Playback.Cleanup() properly before and after the method.  Something
3. A given test method is executed in the same thread irrespective of what lies inside it.
4. Yes, UserControl.cs has been removed.  The code that was being generated is now part of the product itself.  Please refer http://blogs.msdn.com/mathew_aniyan/archive/2010/02/10/visual-studio-2010-rc-is-now-available.aspx for steps to upgrade to RC.

My solution:

Add playback.inistialize and playback.cleanup in the code that thread-one contains.

In out class, even it is [codeduitest], also need to do initialize and cleanup except tesmethodtinital() and testmethodcleanup() methods are use before our test method.


Other information on "CodedUI Content" can refer to this blog that is support by MSFT from microsoft:

http://blogs.msdn.com/b/mathew_aniyan/archive/2010/02/11/content-index-for-coded-ui-test.aspx

http://blogs.msdn.com/b/mathew_aniyan/archive/tags/faq/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值