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 | C# | 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.
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.
Java | Selenium | BDD
Serenity is a BDD framework that works with Java and Selenium WebDriver. Serenity also offers functionality such as:
– Providing WebDriver management
– Taking screenshots
– Running tests in parallel
– Facilitating Jira integration
I have not used Serenity because it doesn’t integrate with my Visual Studio, but I know people who do and they all say fantastic things about it.
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.
C# | Selenium WebDriver | BDD | Specflow
If you are looking to build Behavior Driven Development tests using Selenium WebDriver and C#, then Scott has the code that you want to see. He utilized SpecFlow’s framework to run his tests. This resource is not a real framework, but some sample code. However, I always recommend you look at all the code you can as a practical method of acquiring knowledge from other individuals.
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
C# | Code Coverage
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.
Nikolay Advolodkin is a self-driven SDET on a lifelong mission to create profound change in the IT world and ultimately leave a legacy for his loved ones, community, and the world at large. Today, he serves as the CEO and Test Automation Instructor at UltimateQA.com and contributes informative articles to leading test automaton websites like SimpleProgrammer.com and TechBeacon.com