UI Automation With C# and Selenium: Adding Packages

The Takeaway: Installing the right packages from the start makes everything else a lost easier.

So far, we’ve created a blank solution with a few projects and added that solution to a repository. Now we need to install the right packages so that when we start coding some tests, everything will be in place and we won’t need to go back and figure out what we’re missing. For our automation, we’ll start out with the following packages:

  • Selenium
  • NUnit
  1. In your automation solution (which you can find the previous post for here), Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution

    Visual Studio - Manage NuGet Packages
    Visual Studio – Manage NuGet Packages
  2. Select the Browse option and search for Selenium 

    Visual Studio - Selenium NuGet Packages
    Visual Studio – Selenium NuGet Packages
  3. For each package Selenium. WebDriver and Selenium.Support, select the package. Notice that the project where our tests live is the only option available installing this package. Remember, since the framework is a Shared Project, there’s no DLL file created for that project, but the files required for the tests will be automatically included when the test project is built 

    Visual Studio - Packages Install in the Test Project
    Visual Studio – Packages Install in the Test Project
  4. Select the Test project (UI Tests in the example above) and select the Install Button 

    Visual Studio - Installing Packages
    Visual Studio – Installing Packages
  5. You’ll probably need to confirm the install of each package as well 

    Visual Studio - Review Package Install
    Visual Studio – Review Package Install
  6. After both the Selenium.WebDriver and Selenium.Support packages are installed, search for and install the NUnit and NUnit .Console packages as well 
    Visual Studio - Installing Nunit Packages
    Visual Studio – Installing NUnit Packages

    Once the NUnit packages are installed, you can select the Installed link and see that several NUnitpackagaes were installed. These packages will be the basis for our framework and tests, but we’ll add more as we progress.

UI Automation With C# and Selenium, Part I

For the past few years, I’ve struggled with a desire to publish a “how-to” series
on automation. On one hand, there are already LOTS of resources out there, frankly, written by people much better at development and programming than

Selenium
Selenium

I am. Dave Haeffner, for example, does a great job of explaining how to get started in his Selenium Guidebook. And now that it’s available in multiple languages (Java, Ruby, C#, Python, JavaScript), that’s an awesome resource for anyone looking to get started in UI and browser automation.

However, as I’ve grown as an automation engineer, especially in the past year, I still find it hard to find resources that do a great job of explaining how to expand your automation palette, moving beyond the

Nunit
Nunit

basic ideas of UI automation, and including:

  • Data-Driven Automation and Testing
  • Keyword-Driven Automation and Testing
  • API Automation and Testing
  • Security Testing
c-sharp
C#

Furthermore, finding resources that speak to the implementation of these ideas in a C#/.NET environment is even more difficult. 

So, the idea is to show some real-life examples of how to implement an automation solution for testing websites and browser-based applications.

Check out my webiste to get an idea of the tools I use in my own automation.

ASPDOTNET
ASP.NET

Some of the ideas I share are ones that I implement in my own work, some may not be. Some may be ones that I figure out while I’m writing these articles and implement because of them.

If you have ANY questions or want to discuss anything, please feel free to comment or e-mail me.