Erstellt von adam_mohamed
vor mehr als 11 Jahre
|
||
Best Practices: Use the Coded UI Test Builder . Create your test as a sequences Create a new test method per page ?? should we create a GUI Map for each one. NOTE a separate method for each dialogue comprehensible names for methods DO NOT MODIFY THE Recorededmethods.cs DO NOT MODIFY THE Uidesigners.cs Limit each method to less than 10 action s
Perhaps a description of how the Coded UI frameworks will help you understand what is going on and how you can use it to acheive what you seek.When creating a Coded UI Test, 4 files are created.1. CodedUITest.cs - based on the name of the test created. This is the test class used to execute methods in your UIMap.cs and UIMap.Designer.cs classes2. UIMap.Designer.cs - This file contains a UIMap class with the attribute Generated Code. This code is regenerated upon modifications to UIMap.uitest which can be triggered by recording new controls or adding assertions. It is not intended to be modified by hand. This is meant to be done in UIMap.cs because UIMap.Designer.cs is a partial class which pairs with UIMap.cs. This means that all objects and methods in UIMap.Designer.cs can be referenced in UIMap.cs. For this reason, Issue #3 Now, the new control is added to UIMap.Designer.cs and I want to use this control in UIMap.cs takes care of itself. You should automatically be able to reference the new control in UIMap.cs 3. UIMap.cs - contains a partial UIMap which pairs with UIMap.Designer.cs by default, that does not initially contain any methods or properties. You can include custom code here which references objects and methods in UIMap.Designer.cs.4. UIMap.uitest - contains an xml based structure which defines the control hierarchy, actions, properties, and recorded methods. This xml is used to create the generated code contained in UIMap.Designer.cs. Any changes to this file will trigger a new generation of UIMap.Designer.cs. Also, any changes here will automatically persist on subsequent recording or addition of controls. If you wish to make adjustments to an improperly recorded control (I.e. improperly found control heirarchy), it is suggested to repair the UIMap.uitest file by hand in an xml editor. Perhaps, next time, when I add a new control, it agian generates UIMap.Designer.cs and Uimap.uitest. ^ This is because of the way the Coded UI framework is designed. I wish to continue with UIMap.cs class, as I have done lot modifications according to my logic. Only question is to use the new control in Customized class, independently from the UIMap.designer.cs. You should be able to just go forward and continue in the UIMap.cs. The UIMap.Designer.cs file should contain only UIobjects and assert parameters if you did not record any interactions. You added the object with an assertion created with the Coded UI test builder, thus there are no interactions only an assert and assert parameters. Do what you want with this new object in UIMap.cs as it is a partial class of UIMap.Designer.cs and will have reference to the new control. Finally, drive any custom interactions in defined in UIMap.cs in CodedUITest.cs.On the other hand, if you wish to outright remove UIMap.Designer.cs so as to remove any dependencies on it, you will be going against the framework design and will have to construct the UIMap manually. This defeats the intended purpose of the Coded UI framework, which is to make automated testing simplified and extendable. But...MS appears to be working on something that does do what you seek. It is called the Coded UI Test Enhanced framework. Unfortunately it is currently offline. It claims to "Keep UI Object definitions separate from automation code (no more UIMaps)"See:Coded UI Test Enhanced Framework now availablehttp://blogs.msdn.com/b/vstsqualitytools/archive/2011/08/04/coded-ui-test-enhanced-framework-now-available.aspx &
Videoshttp://www.youtube.com/watch?v=d7Z8KD6FhoU -- shared stepsArticles:http://msdn.microsoft.com/en-us/library/jj159335.aspxPerfect article end to end
Best Practices
UI Frame work
Videos and resources
Möchten Sie kostenlos Ihre eigenen Notizen mit GoConqr erstellen? Mehr erfahren.