I'm using webdriver to automate our browser testing, I have some scripted tests already where I am using Visual Studio and while I don't mind other formats I'm looking for a good supportable framework that I can still use in Visual Studio. I'm working with NUnit now but I am not sure how expandable this will be for me in the future, my experience with it is limited and I fully expect to have a lot of test cases for browser automation in the future and want to be able to pull out tests and functions into separate areas.

I've looked at a few other frameworks (STAF and Watin) but not deeply, and I want to keep using the webdriver framework since I have become familiar enough with it to know it will support the site I am testing. Has anyone wrapped webdriver in a C# or .Net framework and can give me some suggestions as to frameworks or tutorials that will get me started?

NUnit is good, but I just keep getting this nagging feeling that I am not using it for its intended purpose since my goal here is to automate our browser regression tests. I know its not only for Unit Tests, but I sometimes get the feeling that I am doing something that is not a fit, but maybe that is just me. Ideally, I would like to be able to enhance my framework to not only run our tests to validate the site but add in tests where I can pull data from our database either to run tests, or for verification. So I would like some extensibility, and if I need to code that if its not available, I am ok with it.


  • By WebDriver, do you mean in it's current incarnation after merging with Selenium? If so, you've described my current automation setup. Sep 1, 2011 at 19:45
  • I am using the current C# version of WebDriver, are you just running it as is within Visual Studio in NUnit or do you have something else around it?
    – MichaelF
    Sep 1, 2011 at 20:05

4 Answers 4


Currently, my setup is Visual Studio 2010, Selenium 2, SpecFlow or StoryQ, and NUnit. Since Visual Studio is what I'm most comfortable in, I wouldn't have it any other way. Selenium/Webdriver's libraries work great in there as well.

As far as NUnit within, it also works great. Typically, for simiplicity sake, I create each class as it's on test fixture. From within there, you can add your test attributes, such as categories for breaking down the tests further.

There is a Visual NUnit extension for running NUnit directly within Visual Studio, however, I really don't like it and typically just use the NUnit GUI. The extension is good however for when you just need to run individual tests as you are writing or debugging them.

I haven't found any hard limitations yet, although they may exist. As for learning about it, this site, Stack Exchange, IntelliSense, and one of our Dev's that's been trying to help us out has been good enough for me to really get going over the last year or so.

If you need me to expand any particular parts, just let me know.

  • This looks good, I've been thinking about BDD for these projects recently but hadn't really given it a lot of thought. This might be more useful and I think fit in better with the kind of testing I want to do. Thanks!
    – MichaelF
    Sep 2, 2011 at 13:13

I am using Selenium 2/Webdriver with Visual Studio and MSTEST. Really MSTEST and NUNIT have pretty much equivalent functionality. Unless you want to really get crazy, either should have everything you need for the purposes of executing your automated tests. MSTEST is the command line version of the built in test harness for visual studio. One limitation is that you need visual studio installed on the client where you execute your tests (but you can use a visual studio test client install as well if you have licenses for it). If you have TFS and/or use Visual Studio Lab Manager there are also some really cool integrations. You can take a look at an introduction video showing what is possible using Visual Studio Lab Manager here: http://msdn.microsoft.com/en-us/vstudio/ff945982.

A pretty cool scenario it enables is
1) Detect a new build and kick off automation for it.
2) Automatically provision a web server (spin up a VM using Hyper-V)
3) Deploy a build to that server
4) Spin up a VM for an automation client
5) Deploy your automation to that client
6) Kick off the automation and if there is a failure take a snapshot of the failure
7) Automatically create a bug with the snapshot attached so a developer would have an exact repro environment.

This could be a bit overkill depending on how much automation you plan on having... If you are working on a mid to large sized project, or multiple projects then being able to manage lab resources and kick off build over build automation with no manual intervention becomes a more important issue.

  • Very nice, I do like the ability to be able to kick off the build. I have VS Test Clients, I use them for my WebTests when I run load scenarios, I kick those off from my laptop on the VM and let it run on the weekend. Haven't looked into Lab Manager but that is a nice idea. Thanks!
    – MichaelF
    Sep 7, 2011 at 12:38

Just use Coypu. It is a wrapper for Selenium/Watin etc., so you can easily swap to another framework later on, and it's heavily maintained. I wouldn't use any other layer. Much more maintainable. As it is available via Nuget und references the Nuget Selenium package, you always stay up-to-date via a simple UpdatePackages from within VS.

Combine that with SpecFlow and as you see in the screenshot, with Resharper you got the ideal combination. Though Resharper costs money (I think 120$ personal license), I think it's the best integrated testrunner, and you get a lot of good features along the line. If you also run unit tests along your development, you should also use NCrunch (www.ncrunch.net), as this is just the best you can do for unit testing in VS right now. But I wouldn't recommend NCrunch for integration tests, that's just insane.

I'd like to post links to all of them, but as a new user I'm only allowed to use 2 hyperlinks.

  • Very cool stuff, I will keep it in mind. I've already started down the path with SpecFlow and it's working for me so far. I'll check this out though, thanks very much for the recommendation!
    – MichaelF
    Sep 9, 2011 at 17:31
  • Am liking Coypu
    – AndyM
    Jun 7, 2013 at 9:37

This is pretty simple and straight forward as compare to java as per my experience. The best part is there are many help available now than before. If someone is naive for selenium and C# then refer this:
http://learnseleniumtesting.com/basic-webdriver-and-c-sharp-script-for-beginners/ else if you are experience and looking for some readymade framework ready to start writing test then:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.