Have you ever tried to build an Enterprise-level automation framework? You’re not the first.
Luckily, many smart individuals have been creating different tools and frameworks to deal with automation for many years. Therefore, if you are trying to do some automated UI testing, automated unit testing, static code analysis, or something else, there are tried and tested tools and frameworks that can help you to accomplish your goal.
What follows here is a list of the best C# automation frameworks and tools you should be using. Everything in this list is applicable to .NET. However, some tools may be more generic because they can be used with any programming language.
I’ve compiled this list based on my years of experience as a test automation developer. I’ve used the majority of these automation frameworks and can vouch that they are a solid choice for your needs. The tools that I did not use, I researched thoroughly to provide you with the best of breed option.
[Tweet “Check out the best collection of C# frameworks and #tools. Includes unit testing, #BDD frameworks, mocking frameworks, #ATDD frameworks, and more.”]
Selenium WebDriver Framework Code
Selenium WebDriver | GUI Testing | RESTful testing | SauceLabs
This framework is one of the most feature-rich frameworks that I have ever seen in the industry. It helps you to build GUI tests, RESTful tests, and tests against Windows applications and runs all of these things locally or in the cloud. I spent many hours looking at this code and learned a lot.
The creator has some excellent strategies for making very readable tests. Furthermore, he creates great logs, screenshots, and video recordings to help debug the failed tests. Sadly, I cannot get it to run consistently, but it’s a great place to start building from. Also, it hasn’t been updated in awhile. I did fork my own copy and cleaned up all the compilation issues if you want to take it for a spin.
Selenium WebDriver | Page Object Model
This is a robust Selenium automation framework that will help you to get started with the Page Object Model and GUI automation. Furthermore, this framework contains many advanced techniques to help you manage large page objects, good solution architecture, and creating HTML reports.
If you are interested in learning more, I actually have an entire video course where I teach how to develop such an automation framework. Fork it or download it to get some new ideas for your future framework.
Bumblebee is a .NET layer on top of the Selenium browser automation framework that allows for the standardized creation of page objects, even for dynamic web pages. There are a few features that define Bumblebee’s usability.
- Standardized UI interfaces
- Modular page objects
- IntelliSense-driven automations
- Test Framework independence
- Parallelization mindfulness
I actually haven’t used it myself, but it looks really promising and I hope to use it in the future for my test automation.
Selenium Webdriver | Test Studio | C#
Angelov has a ton of useful code that you can look at. He applies different design patterns to his code to show you how it would look. For example, you can see how to use the Strategy Design Pattern, the Facade Design Pattern, Page Object Model, and Advanced Page Object Model. You can cycle through it and decide which code you want to reuse. The code will help you to get started on your own test automation.
C#| Selenium Webdriver | BDD
SpecFlow is one of the few C# BDD frameworks out there, which automatically makes it a highly desirable automation tool for you to use in your development projects. This framework helps you to build acceptance tests using business readable specifications. You use the Gherkin syntax to build tests that read close to plain English. Therefore, these tests are readable by the developers, testers, and business personnel, and in theory, serve as living documentation that can replace requirements.
Test Automation Framework
Gauge is a test automation framework designed by the team that created Selenium WebDriver. In their words, “Gauge is a light-weight cross-platform test automation tool with the ability to author test cases in the business language.”
Although I haven’t explored the framework myself, it does strike me as interesting since it was created by the Selenium guys. They do seem to create resources that change the world. It’s a program I will look at in the future, and you should as well.
Unit Testing Frameworks
C# | Unit Testing
NUnit is definitely the most popular C# unit testing framework. It’s extremely active on Github with tons of contributors and commits. You can use this framework to do unit testing and also acceptance testing with a tool like Selenium WebDriver. It’s pretty easy to use as well as being robust. The documentation is also good and there are tons of online resources to help.
I’ve used this open source mocking framework and I can vouch that it works well. It makes mocking for test automation easy using .NET Linq expression syntax. The documentation is also rich and descriptive. The Github community has about 60 contributors and there over 1,000 commits. This means that the project is being updated. Plus, you can find an excellent tutorial on how to use it on Pluralsight.
I have not used this mocking framework. With a quick look at the documentation page, you will see that it’s a framework that reads really well. The format of the mocks makes it easy to read and understand. Therefore, if you have some issues with using Moq, you could give FakeItEasy a try and I believe that it will satisfy your mocking needs.
FitNesse is an acceptance testing framework that is language agnostic. One great thing about the program is that you can create and edit requirements through the web browser, which makes it simple for everyone involved with the project to interact with this tool. “Using acceptance tests allows for better collaboration because now the stakeholders can design the documentation that becomes testable”. This program is a good way to improve communication between business personnel and programmers.
Mutation Testing and Property-Based Testing
C# | Mutation Testing
Have you heard of mutation testing? It’s an interesting concept that allows you to basically reverse all of your assertions to see if your automated tests will ever fail. This concept is something that I need to experiment with. I’ve seen a number of automated tests in my career that will never fail. It’s always disappointing to see such tests. A mutation testing tool will point out the tests that never fail so that you can fix those tests.
Visual Mutator is one of the few C# tools that seems decent at performing mutation testing. I looked at change logs, documentation, and website to determine the quality of this tool. I have not used it myself yet, but this one seems worthwhile if you are going to pursue mutation testing.
C# | F# | Property-based testing
FsCheck is a tool for testing .NET programs automatically. “You can provide the properties of a program — that is, which functions, methods or objects should satisfy. FsCheck tests those properties to see if they hold in a large number of randomly generated cases”.
FsCheck supports multiple testing frameworks like NUnit, MsTest, and XUnit. Furthermore, their documentation is pretty good and you shouldn’t have much trouble getting started.
Code Coverage and Static Analysis Testing
Static Code Analysis | Continuous Code Quality | Multi-language support | Free
This is my new favorite static code analysis tool. It is so easy to integrate with your Github account and link it to a project. It already has a bunch of rules pre-configured for your language settings.
When you start breaking some of the rules, it will fail your continuous build and will let you know that your quality is degrading.
If you want to fix problems, there is great documentation into why certain lines of code are potential code issues.
DotCover is a tool in the ReSharper Ultimate suite that allows you to get code coverage metrics for your code. You can execute your unit tests and then see which parts of your code are covered and which parts are not by using the provided useful highlighting.
Static Code Analysis | Continuous Code Quality | Multi-language support
I strongly believe in excellent quality in all source code, including test code. However, maintaining quality code can be extremely tough. Every bad coding decision can quickly get out of hand and cause your test code to rot.
An excellent way to decrease the amount of rotting code is to set strict standards on code quality. Then, you can use static analysis to make sure that your team standards are enforced. SonarQube is a tool that I am excited to learn and include in my test automation pipeline.
SonarQube provides a home page that shows where you stand in terms of quality. Quality gates can be set to prevent smelly code from going into production. You can also run the analysis on your pull requests, which provides you with the capability to quickly see how your code has impacted the whole project.
Go and use these tools to drastically improve your test automation skills. You now can automatically perform code coverage, unit testing, property-based testing and so much more. All of these tools will ultimately help you to achieve the higher software quality that everybody seeks. If you would like to further expand your skills, be sure to check out The Best Books to Learn Test Automation.