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?
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