Question

i am trying to automate the gui in c# .Is this same as browser automation .how can i start ui automation

Was it helpful?

Solution

You can use Microsoft's UI Automation library, but it isn't much fun. "White" is a better alternative... see: http://www.codeplex.com/white

EDIT:

New url to "White" project as it was moved to TestStack on GitHub: https://github.com/TestStack/White

OTHER TIPS

If you are using WPF, Microsoft has a very detailed UI Automation library.

http://msdn.microsoft.com/en-us/library/ms747327.aspx

I had a look around but I couldn't find an equivalent for WinForms.

WiPFlash is good, easy to use, open source wrapper on top of Microsofts UI automation library. But they're limited by the underlying Microsoft Automation structure.

Be careful if your GUI is using any 3rd party Windows controls, like Devexpress controls, or Telerik controls.

MS UI Automation would have difficulties to locate those fancy grids, lovely menus and pretty icons.

Talking about TestStack.White, it's using MS UI Automation as the cornerstone, so it would face the same problem locating detailed GUI elements.

You will know when you need to manipulate the grid by row but UI Automation or TestStack.White could furthest only return you the table object, then you will find your R&D efforts before the project starts were all wasted. That's how I learned that lesson, but now I am the expert.

http://msdn.microsoft.com/en-us/library/ms747327.aspx like Alastair Pitts pointed out can be used. From my knowledge it should be good for any automation tasks - as long as Windows recognizes the control your application uses as standard controls or controls that have automation support. Which should be the case for just about all major control vendors. And defnitely MFC, Win32, WinForms and probably WPF and Silverlight as well.

You can get an idea of what you are up to (against) by firing up Spy++ and having a look at what it displays.

You might also want to listen to the other ideas, using Tools like White (opensource) or Rannorex (which is commercial).

FlaUI is a good alternative to "White" library, based on native UI Automation libraries from Microsoft.

9 Years later Appium is a good option, also a reference side from Microsoft, since CodedUI is obsolet. Microsoft build the WinAppDriver for Appium. You can also just use the WinAppDriver to test your gui. you need Appium, just if you want to do contionouos integration.

Differences:
Teststack.White is an efficient Testframework. It doens´t need as much time as WinAppDriver (Appium) to go through the tests and its very easy to implement in your testproject. But the support isn´t as good as WinAppDriver. Teststack.White as example still doesn´t support UWP (maybe no one want to develope with UWP :P ). On the other side, you need Windows 10 or Windows Server 2016 to work with the WinAppDriver. Both have an easy implementation of tests, but you need to set some JSON-Values, to get a http-connection with the WinAppDriver.
At least the WinAppDriver with Appium has much more possibilities, but TestStack.White is easy implemented.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top