I am writing automated tests for my company, and I am doing so from the ground up. We provide both desktop and web applications to our clients. After doing a lot of research and testing, I landed on Selenium for the web tests because it seemed easiest and most powerful while still giving me total control over my tests. For desktop applications, I initially landed on Visual Studio's own Coded UI Tests, as it was the only GUI tester that gave consistent results. However, Selenium uses NUnit and Coded UI tests use Microsoft's own test framework. My question is, is there a framework that I can use to run both web tests and GUI tests? I'd prefer to continue to use Selenium if possible. Most other GUI testing applications I've tried are inconsistent or don't allow programming. I can obviously just bypass the GUI and call our application's methods directly, but if there is a way to test the GUI as well, that would be preferred. Any suggestions that use C# would be particularly appreciated.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
As Lyndon said, you can use Selenium 2/Webdriver for desktop applications, although to do this you have to compile in the web driver (caveat: I don't know any more about it than this).
Some other alternatives based on the information in your question:
You can use NUnit with Microsoft's unit test framework for both web and desktop applications. I don't know the mechanics of it, only that it can be done.
With CodedUI - which works for both web and desktop - Microsoft abstracts a lot of the grunt work from you. Based on a quick Google, CodedUI doesn't support NUnit because it build on the MSTest framework. I've personally found CodedUI limited when dealing large applications with a lot of internal dependencies and ended up building myself a hybridized custom framework on top of the CodedUI dlls (still very much a work in progress).
In terms of GUI testing, I know for a fact that SmartBear's TestComplete handles web and desktop and can use a script flavor of C# (I'm not on their staff - I just used the tool for close to 7 years), with the level of control over your tests that you're looking for. It's also the cheapest of the big box tools (but still not precisely cheap). I know you said you've decided on tools, but I thought I'd throw the option out there in case you're open to changes because of the differing frameworks.
Another option for you is to write a custom wrapper that allows you to unify your test frameworks from the front end - essentially a harness that can invoke either the Coded UI or the Selenium tests and pull the results to a common location with optional format massage so that you can view the results from a single portal. That's probably the easiest method - you don't have to Frankenstein any of the tools to make them do things they're not designed to do and you're not bound to any particular tool for all eternity.
As long as you are using Selenium 2/Webdriver, there should be no reason why MS Test should not work for you. Although I normally use NUnit myself for Selenium tests, I just tried a couple of quick tests using MS Test instead of NUnit and found that it worked pretty much exactly the same.