Automated Testing in CSharp

Subscribe to my newsletter and never miss my upcoming articles

Testing Automation Overview

Hello there 👋, welcome to my article on Automated Testing in C#. Here I would be giving an overview of what Software testing is, why we need to test our applications, types of testing we can perform on our application, and much more. This article is for beginners in Automated Testing or experts who need a refresher on the concepts of Automation Testing.

In this article, I would be covering the following topics:

  1. What is Automation Testing
  2. Benefits of Automation Testing
  3. Types of Testing
  4. Automation Testing Tools in C#

So, let's get started

1. What is Automation Testing?

Before we get started defining Automation Testing, let's imagine we have written our code that requires a user to log in or signup before performing any arithmetic tasks on the platform.

Got that?

Now, imagine you create a new feature for the user to do more arithmetic calculations, say Exponential, Logarithmic functions, or even Calculus. So, how do we ensure our program is working well?

  • We log in
  • Choose our preferred calculation
  • Try out the input values
  • Check if the output corresponds to what we expect
  • If it works well, fine
  • If it doesn't, we have to adjust our code, recompile it, then repeat the above steps all over again

I'm sure you can tell that this would be a pretty long task in a more complex and realistic program(i mean, who logs on to a platform just to calculate 2+2?). This is where Automated Testing comes in, imagine being able to test these features of the program without going through the hassle of launching the application every time we want to check if our features are working properly.

So, that's what Automation Testing is about, a technique used in software testing where we test and compare the outcome of our program with the expected outcome.

So, how does this differ from manual testing?

In Manual testing, test cases are executed manually by a human without the help of tools or scripts. But with automated testing, test cases are executed with the help of tools or scripts, which makes testing faster and less stressful. Test automation can be used to automate repetitive tasks that can be complex to perform manually.

2. Benefits of Automated Testing

In addition to being faster than manual testing, automated testing also helps in the following ways:

  1. You get to catch/detect bugs before deploying your application
  2. It is more reliable as it is performed by scripts and tools as opposed to manual testing
  3. Improves accuracy
  4. Automation helps increase test coverage

Testable code is clean, clean code is testable

3. Types of Automation Tests

In my learning process on software testing, I have come across different types of automation testing which are:

  1. Unit Testing
  2. Integration Testing
  3. Smoke Testing
  4. Functional Testing
  5. Regression Testing

Now, let's break them down, shall we?

1. Unit Testing: The concept of unit testing revolves around testing individual components of our code i.e our methods and classes without external dependencies. The purpose of Unit Test is to ensure/validate that each unit of the program works as expected. Unit Tests are cheap to run and they execute fast although it doesn't give full confidence in the code as external dependencies are not tested with the units.

2. Integration Testing: Similar to Unit Testing, integration testing is done by testing methods and classes but this time with the addition of external dependencies e.g Databases, Files e.t.c. It takes longer to execute with relation to Unit Tests but it builds more code confidence.

3. Smoke Testing (Build Verification Testing): The goal of Smoke Testing is to ensure that the most important functions work. The result of this testing is used to decide if a build is stable enough to proceed with further testing.

4. Functional Testing: Here, we use a testing method that validates the program against its requirements/specifications.

5. Regression Testing: In Regression Testing, we check if a recent change in the program or code has not affected the existing features. In Regression Testing, we can also select already executed tests which are then re-executed to ascertain that existing functionalities work well.

That's about the summary of the types of Tests we have available, next, we would give a small insight into the types of Automation Tools available in C#.

Automation Testing Tools in C Sharp

For Unit Testing, there are three major types of testing tools and frameworks available.

  1. MsTest
  2. NUnit
  3. XUnit

I would be covering these Frameworks later on as I drop more articles on Testing. I would be updating this article the more I learn more stuff that'll be helpful in testing. Thank you.

Here are a few links to articles I found that might be helpful:

Types of Software Testing:

What to test/ what not to test:

Comments (1)

Wilson Edafe's photo

Nice one, Chief