Coded-UI Auto Generate UIMap - wpf

I have been looking into using MS Coded-UI as part of a new testing initative. We have exisitng UI automation using the HP stack QC/QTP but have found this to be very heavy weight and error prone, and as a result are looking to coded-ui in a bit to move our automation stack closer to the dev stack.
I am testing a wpf application running on windows 7 desktop, primarily on .net 4.5.
I have 2 questions.
Is it possible to auto generate the UIMap? Could i use a top level UITestControl object, find this and iterate over to generate a map of all subsequent children?
As part of continuous integration, is it possible to look coded-ui tests into a TFS build cycle? I am using visual studio 2012 ultimate but only 2010 instance of TFS. I assume these really all need to be in sync in order to pull this off correctly?

Regarding your first question, you can create Coded UI tests manually by recording your actions through Visual Studio or by using an existing action recording from Microsoft Test Manager.
Since a Coded UI tests is just plain code (C# or VB) you an easily edit it and add extra control logic.
Regarding your second question, it's absolutely possible to run your Coded UI tests as a part of your continuous integration build.
You have a couple of options:
Run your Coded UI tests on your Build Server. If you configure your Build Agent for Interactive use, you can let it run Coded UI tests. This is not my favorite option.
Use Lab Management with virtual environments (requires Hyper-V and System Center Virtual Machine Manager) or with Standard Environments. By using Lab Management you can automatically deploy to test machines and execute Coded UI tests on them.
Use Release Management in combination with Microsoft Test Management. This allows you to setup continuous deployment and run Coded UI tests on your target servers.
Lab Management with Standard Environments is the easiest to get started with, especially since you have an Ultimate license which includes Microsoft Test Manager.
Release Management is new and added to TFS 2013 for deploying to machines from test to production. It's a very nice solution but it currently doesn't integrate with Lab Management.

First question: there is not functionality to discover all children of some top-level parent control. But you can start Coded UI Builder, star recording and click or interact in another way with all controls you are interested in(it takes like a minute even for a window with a lot of children controls). That click Generate, name method like Dummy or whatever. All controls will be added to UI Map, and you can change search properties, names etc.
Second question:
It is possible to set up continuous integration flow including Coded UI tests - build, deploy, test.
Create new Build definition, use LabDefaultTemplate.xaml template for it.

Related

Integration Testing In Visual Studio With Different Project Types

We are in the middle of developing a new CRM, and it uses both WPF for local users, and a Windows Universal App (Store App) for the users in the field. The basic flow is this
Customer calls in and gets scheduled on a field user in WPF app.
Field user goes on service call and updates on Surface through Universal App.
Customer gets billed from the WPF App.
All the modules are in place and working, but I do not seem to be able to integration test the entire project flow due to the different Project Types.
What I need to be able to do is add a reference to my Universal App in the unit test for my WPF app (or the other way around), so I can test the flow through both components.
I have been searching for a solution over the last few weeks, and have not been able to come up with any way to do this. If this is not directly possible (which I am guessing it is not), is there any way I can setup a test playlist so that the integration tests run in a particular order.
I am looking to avoid hard coding sample data into the db in order to test the Universal app, as this would not show the true flow of data from one app to another and back again. Any help is appreciated.
UPDATE 8-21-2015:
We realize because of the Framework difference the best solution is going to be to run some type of ordered test. We are using MSTest. The problem with this is that Ordered Tests in Visual Studios are not solution wide, they are only allowed in a unit test project, which means it will be using the References from that project, and not allow both tests.
We don't care if we have to switch to a different testing framework, as having the proper tests is more important than using a specific framework.
You should use a Portable Class Library (PCL). You can create a PCL in Visual Studio from the add new project screen.
When creating your PCL it will ask you what type of projects you want to target. Since you stated WPF and Windows Store app you would .Net 4.5(or whatever version you are on) and WIndows 8.1 (or 8.0)
The PCL will allow you to write code in the Run Time with the lowest level of language features for the targeted projects. In your case this would be the Window's Store app.
Now, instead of storing your logic inside your Window's store project, you will need to move your logic into the PCL.
Once you have compiled your PCL, you will need to add references to the Window's Store app so that you can use the logic within you Windows Store App (you will have to add the namespace for the PCL to make this work). You will also add a reference to the PCL in your unit test project. Because you targeted both Run times in your PCL, you will be able to call the code from your integration tests.
Since all your Logic is in the PCL, you should be able to test everything. The only thing in your Window's Store app now should be the view specific data.
If you ever need to change the targets for your PCL (lets say want it to work with Windows Phone), you can edit the properties of the PCL project, and change the targets. Be warned that if you add a target with a more constricted run time than one you currently selected, you will have to refactor your code to use only functions available in the lowest functional run time.

Testing Performance or load in WPF application using VS2013

I have a WPF application using standard MVVM pattern. I want to test its performance and load . I see in Visual studio 2013 there is an option to check for Web Performance and Load test . I tried the Load test part of it, but Load test accepts only a test type i.e Unit Test or Coded UI test.
My question is : Cant i directly test the Load of my application without any test cases. Or what is the correct process to test my WPF application.
Never run load test on WPF or any kind of UI application. Load testing is generally done on the tier supporting the load : asp.net, Web Api, WCF ...and sometimes DB.
On UI-tier, it's better to do performance test, I mean simulating a huge amount of data coming from data-tier or with a high rate of transactions/sec. Visual Studio Profiler & Profiling tools will help you to determine the Hot Path and to find application bottlenecks.

Visual Studio 2012 - Performance Profiling Prism Applications

I've been looking to get some profiling reports on a project I'm working on. I've looked at many of the options out there and I've personally used dotTrace and ANTS before but decided to give the Visual Studio built in Profiling a shot.
So far it seems pretty good all in all. Had to jump through some hoops to get it working in the first instance but its running OK now.
The problem I have is that my project is a Composite WPF application using PRISM which means there are no static references between the EXE file and the majority of the logic which resides in the Module class library projects.
This isn't the first time I've seen some usually very good tools get confused by composite applications so I'm not going to hold that against the profiler. However it does mean that 90% of what I want to profile in the application is actually excluded from the reports and remains completely un-profiled. Not helpful.
I have all the libraries I'm interested in profiling added to the Instrumentation session so it's all ready to go the problem is it doesn't seem to follow the execution paths into my Modules internals.
Has anyone managed to get a PRISM app using a DirectoryLookupModuleEnumerator (no static refs) approach successfully and fully profiled?
HA! The cardboard developer strikes again!
One additional complication in my particular scenario is that my compiled application isn't in the usual bin\Debug locations. Each project copies itself and any dependencies into a completely separate location (kind of like deployment I guess) and then executed from there when I debug.
What I've done to get this working:
The usual nasty post signing shenanigans to get the strong names to play nicely
Instead of going through the wizard simply click Start Performance Analysis under the Analyze menu
This will start the performance analysis and should honour any debug setup in your start up projects properties page.
Go back to the Visual Studio 2012/2013 instance you started from.
Right-click on the Targets node in the Performance Explorer panel.
Select Add Target Binary and then in the file browser select the compiled modules that form the composited parts of your application
Run your app as you wish and then select Stop Profiling when you're done.
Explore to see just how crap your code is! :)
NB: last step is optional.

RAD GUI builder (preferably WYSIWYG) for developing a .Net GUI app to run on Linux

I want to build a rather complicated GUI app on the .Net framework. The app will have the following graphical capabilities:
Plotting/updating realtime data
Allow manual (using mouse) drawing/dragging/editing of lines etc on a plot
Allow selecting of graphical objects/shapes on a plot and drag/drirop to a new location on the plot
Ideally, I would like to use VS to do my initial development, because the VSIDE is (understandably) much more sophisticated than the monodevelop tools. However, I will be running the application and maintaining the codebase (once the development phase is completed), on Linux, using monodevelop.
It is important for this reason, that I make sure that I do not use any .Net components that have not yet been ported over to mono.
Given the graphical functional requirements above, I would like to know if I can expect to be able to develop such an app on Windows and then port to monodevelop?.
I am aware that components like WPF have not been ported to mono, so are there any other .Net GUI components (available on mono) that I can use in my application (to make the port possible)?
From a past experience start with a Windows Forms plain app. If you want the port to be as clean as possible forget about complex UI components, you can always use your custom controls but check third-party ones you use don't call Win32 API directly. That you can do it within Visual Studio (check this plugin for more productivity) but I want to warn you about two things:
Interfaces built with Visual Studio (WinForms) when running on Linux look awful.
If you want a clean UI take a look at Gtk#

UI automation tool for a windows based WPF application with Record and Playback feauture

I am in the process of recommending an UI automation tool for a windows based WPF application in a company
Which targets wide range of customers . The Application lives on a layer of WCF services for getting
The data. The company is already having a small VBScript framework written specifically for Test Complete
and is really not robust, Hence I am lookout for a right tool, where we could reuse the scripts or
Improve the already existing tool. Any ideas are welcome.
I have looked at Microsoft UI Automation, Project White, UIA Verify and Ranorex. Each one of them
Is having a feature lack.
I was able to go through the process of Microsoft UI Automation. I am still in the process of understanding how it works
with WPF, since it is totally dependent on Automation IDS.
Our application is huge and is not written with this in mind. All the code either does not implement
Automation ID property or Name property which is very much essential for object identification in the visual tree
in tools like UISpy and VisualUIAVerify.
What I am looking in specific are the following. Please give ratings to each of these
1) Recording : Recording , play back and automatic execution of test scripts and generate a report.
2) Dependencies : Minimal Dependencies(.NET frameworks, API modules , SDK Versions etc..)
3) )Code Generation : Code Generation of test scripts from Templates, Macros and Recording.
4)Object Name Mapping: Avoid explicit usage of Automation IDS and screen corrdinates, if they use, does it support any tools which would take XAML Files and insert Automation IDS into it and also avoid Problems With duplicate Automation IDS.
5) Events: Any Events and call backs that the user(tester) may receive if the GUI has undergone any changes
and how the scripts would change in this Case.
6) Support : Support for different scripting languages and easy Code conversions(C#, VBScript, Python.. etc)
7) Fast and Reliable: Easy and fast accessibility of GUI elements for manipulation( Like support to xml dom, Json.. etc), navigation, code duplication replacement tasks for changes in UI and easy configuration(xml, ini files)
8)Code Converters: the tester writes code in vbscript and developer could simply convert it into c# for embedding them into any stand alone framework if need be).
9)Custom controls: Support for custom controls and object mapping. If you have a custom object that behaves like one of standard controls. are you able to map (tell the test tool that the custom control behaves like the standard) control? Does it support all the standard controls methods? Can you add the custom control to it’s own class of control?
10)Reports: Should be able to execute multiple tests at once and generate a report similar to VisualUIAVerify.
Visual Studio 2010 Coded UI Tests
You can use Visual Studio 2010 Ultimate or Visual Studio 2010 Premium to create automated tests of the user interface known as coded UI tests. These tests provide functional testing of the user interface and validation of user interface controls.
I am using Coded UI Tests to automate tests of a WPF application built on the MVVM pattern. The record/playback features of the tool are impressive, generating really nice models. For large suites, the advice is to tear apart the generated code, structuring and extending it for your own purposes.
I recommend Visual UIA Verify to assist viewing the automation structure of your application while developing and debugging.
Have you tried AutomatedQA testcomplete
http://www.automatedqa.com/products/testcomplete/

Resources