Skip to content
KnowledgeCity

Microsoft Visual Studio Beginner: Unit Testing

Enhance code quality by writing effective unit tests
Preview the first lesson free — get full access to all 4 lessons.
Course: On-Demand
Beginner Provider Gerald Eckert  4 Lessons ·  27m  in Arabic, German, English, Spanish, French, Portuguese, Chinese 

Course Description

Unit testing is critical to ensuring you have written quality code. If your code breaks often, constantly needs to be refactored, or is very old, unit testing is often the solution to these problems. With unit testing you can test your code for many of the scenarios it will encounter. This allows you to quickly find points of failure and weaknesses, fixing them before they create bugs. To do this, we will look at setting up unit test classes and writing unit tests to test the functions. We will explore purposefully failing our unit tests and reviewing error messages. With unit tests set up correctly, you will generate fewer regressions, fewer bug reports, and reduce technical debt.

In Unit Testing, you will learn how to create your first unit test and streamline unit testing with MS Test attributes. We will also discuss project settings and learn test driven development within Visual Studio.

What You'll Learn

  • Create your first unit test in Microsoft Visual Studio
  • Set up unit test classes and unit test projects using MSTest attributes
  • Write unit tests to test your functions, including purposefully failing tests and reviewing error messages
  • Apply test driven development to new projects within Visual Studio
  • Improve code quality by unit testing
  • Streamline unit testing by using attributes and configuring testing setup procedures

Key Takeaways

  • Unit testing helps you find points of failure and weaknesses in your code so you can fix them before they create bugs.
  • Unit testing lets you test your code for many of the scenarios it will encounter.
  • With unit tests set up correctly, you generate fewer regressions, fewer bug reports, and reduce technical debt.
  • MSTest attributes and testing setup procedures help streamline the unit testing process.
  • Unit testing is often the solution when code breaks often, constantly needs refactoring, or is very old.

Frequently Asked Questions

What will I learn in this course?

You will learn how to create your first unit test, streamline unit testing with MSTest attributes, configure project settings, and apply test driven development within Visual Studio.

How is the course structured?

The course includes four lessons: Creating Your First Unit Test; MSTest Attributes and Setting Up Unit Test Projects - Part 1; MSTest Attributes and Setting Up Unit Test Projects - Part 2; and Test Driven Development With Visual Studio.

What skills will I gain from this course?

You will build skills in Code Testing, MSTest, Software Testing, Unit Test-Driven Development, Unit Testing, and Vstest.

Why is unit testing important?

Unit testing is critical to ensuring you have written quality code; it lets you test your code for many scenarios it will encounter, quickly find points of failure and weaknesses, and fix them before they create bugs, resulting in fewer regressions, fewer bug reports, and reduced technical debt.

Does the course cover what happens when tests fail?

Yes. The course explores purposefully failing your unit tests and reviewing the resulting error messages.