Selenium vs Coded UI Thoughts
I should mention that this is not intended to be a full in-depth review and comparison of the two UI testing frameworks, just a quick post on my general thoughts after using both of them on the same project.
I have recently started work on introducing some basic automated UI tests to one of our solutions. Before I started down this road, I naturally googled “Selenium vs Coded UI”, to get an idea of differences, pros and cons of each, etc. There are quite a few articles out there that break this down, but I am going to give you some thoughts from my personal experience with both of these testing frameworks.
First of all, I should mention that I will be testing an MVC web application. This is the only reason that I could even consider using the Selenium WebDriver, as it does not support testing of non-web applications. I have also had some previous experience writing tests with Selenium. It was this reason that actually had me initially go down the road of using Coded UI. It was new to me, and I wanted to learn a little bit about it before deciding if it would be a good fit. Plus, it being essentially “built into” Visual Studio was a pro for me.
Coded UI was initially pretty painful for me. It just wasn’t as “easy” as I though it should be to do simple things, like finding an element on a page, and entering some text, etc. There are even extension libraries out there to help with this. To me that suggests that it’s not as easy as it should/could be. Coded UI did have a very nice test recorder IDE that is built right into Visual Studio, this was definitely a pro, and is something that could come in very handy for someone who wants to write tests in C# but has limited knowledge of the language perhaps. (QA maybe) Although for this scenario, I wanted to hand write these tests to have complete control over everything, so the recording IDE was more than I needed. It also generates a ton of code since it literally mimics every action you perform. (Hovers, pauses, you name it). Another thing to note about the project I am testing, is that it relies heavily on the Telerik Kendo UI MVC controls. These can sometimes be difficult to test merely through browser emulation like we’re doing. To be honest, I quickly gave up on Coded UI, it just didn’t feel like it was flowing as easy as I thought it should have.
I then made the switch to the Selenium WebDriver and never looked back. To be fair, I was somewhat familiar with Selenium, but even still I found it very easy to jump right in and create some tests very quickly. I also like that you can provide different drivers for each browser, whereas Coded UI is mainly for testing against IE.
Overall, it was pretty easy to find elements on my page using Id selectors, class selectors, etc. There is also a recording plugin for Firefox, if you wanted to go that route. Once again, I just wanted to hand code these tests.
By default, most people will use the Firefox driver with Selenium, but I opted to download and install the IEWebDriver. I simply had to copy this .exe into C:\Windows, and I was off. Note* – Your build server will also need this .exe to be able to run tests obviously.
Conclusion: I found Selenium a lot easier and more intuitive to work with in this particular scenario, which was a web application making heavy use of client side controls with Kendo UI. I also had much better success with documentation and troubleshooting help with Selenium. The Coded UI community seemed a little more scarce, and trying to figure out how to do basic things was sometimes difficult.
If you had similar, or different experiences with these frameworks, I’d love to hear. Is it worth giving Coded UI another chance?
Thanks for reading.