Complete Guide to Unit Testing in .NET Core (NUnit & xUnit)
Offered By: Packt via Coursera
Course Description
Overview
Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Dive deep into unit testing in .NET Core with this guide, featuring NUnit and xUnit. Starting with a solid foundation, you'll understand the principles of manual and automated testing, the advantages of automation, and the necessary tools. The initial modules will set you up with a strong base in different types of tests and the testing pyramid, preparing you for hands-on projects.
As you progress, you'll create and run your first unit tests using .NET 6, MSTest, and NUnit, followed by debugging and asserting. Advanced concepts like combining unit tests with expected results, asserting various data types, and setting up global initialization for classes will enhance your skills. Assignments and solutions provide practical experience, ensuring you can handle real-world scenarios effectively.
The course also delves into advanced NUnit concepts, Moq framework integration, and xUnit testing. You'll learn to handle collections, exceptions, and inheritance in NUnit, use Moq for mocking dependencies, and perform extensive xUnit tests. Real-world examples will solidify your understanding and prepare you for professional application, making you an expert in .NET Core unit testing.
This course is designed for .NET developers, QA engineers, and IT professionals seeking to master unit testing in .NET Core. Basic programming knowledge and C#, .NET Core, EF Core skills is recommended.
Syllabus
- Introduction to the Course
- In this module, we will introduce you to the course, covering the basics of manual and automated testing. You will learn about the tools needed and gain an understanding of different types of tests, including the testing pyramid and the logical phase of an automated test.
- First Unit Test
- In this module, we will guide you through the initial steps of setting up your first unit test. You'll learn about the nullable feature in .NET 6, create a project, and explore writing and troubleshooting unit tests using MSTest.
- Unit Testing
- In this module, we will delve into unit testing with NUnit. You will create NUnit projects, write tests, and use debugging and assertion techniques. Additionally, you'll complete assignments to solidify your understanding and handle various assertion scenarios.
- NUnit Testing - Advance Concepts
- In this module, we will explore advanced concepts in NUnit testing. You will learn to assert collections, handle exceptions, and set up inheritance. The module includes assignments on grading calculators and the Fibonacci series to apply these advanced techniques.
- MOQ with Unit Testing
- In this module, we will focus on using MOQ for unit testing. You will learn to set up and configure mock objects, perform integration tests, and handle various scenarios with loggers and return values. The module also covers advanced MOQ features like properties and callbacks.
- xUnit
- In this module, we will cover unit testing with xUnit. You will create xUnit projects, compare it with other frameworks, and work on assignments related to grading calculators and the Fibonacci series. The module also includes topics on MOQ integration with xUnit.
- Real-World Example - NUnit
- In this module, we will apply NUnit testing to real-world examples. You will set up main projects, data access unit test projects, and Bongo core projects. The module covers in-memory databases, core unit tests, and web application testing, ensuring you can handle complex testing scenarios effectively.
Taught by
Packt - Course Instructors
Related Courses
Building Test Automation Framework - Selenium, C# & NUnitCoursera Project Network via Coursera Fluent Assertion
Board Infinity via Coursera MOQ
Board Infinity via Coursera Data-Driven Testing (via Database) with Selenium & Nunit
Coursera Project Network via Coursera Data-Driven Testing (via spreadsheet) with Selenium & Nunit
Coursera Project Network via Coursera