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.
Selenium WebDriver Framework Code
Selenium WebDriver | GUI Testing | RESTful testing | SauceLabs
This framework is one of the most feature-rich frameworks. It helps you to build GUI tests, RESTful tests, and tests against Windows applications, and it runs all of these things locally or in the cloud.
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.
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.
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
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.”
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 robust. The documentation is also good, and there are tons of online resources to help.
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.
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. 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.
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. With them, you now can automatically perform code coverage, unit testing, property-based testing and so much more.