The xUnit.net Testing Framework

Learn the latest unit testing technology for C#, VB.NET, and other .NET languages.
Course info
Rating
(189)
Level
Intermediate
Updated
Oct 9, 2013
Duration
2h 49m
Table of contents
Description
Course info
Rating
(189)
Level
Intermediate
Updated
Oct 9, 2013
Duration
2h 49m
Description

Learn the latest in unit testing technology for C#, VB.NET (and other .NET languages) created by the original inventor of NUnit. xUnit.net is a free, extensible, open source framework designed for programmers that aligns more closely with the .NET platform.

About the author
About the author

With over 15 years experience, Jason Roberts is a Microsoft .NET MVP, freelance developer, and author.

More from the author
Mocking with Moq and NUnit
Intermediate
1h 53m
Feb 22, 2019
Introduction to .NET Testing with NUnit 3
Intermediate
2h 6m
Dec 17, 2018
More courses by Jason Roberts
Section Introduction Transcripts
Section Introduction Transcripts

Introduction and Installation
Hi. I'm Jason Roberts from Pluralsight. Welcome to this course on the xUnit. net Testing Framework. In this module, we'll look at what xUnit. net is, why it was created when we already have testing frameworks we can use, how we install the xUnit. net framework, and how we can use it to write a simple first test. We'll learn how to enable the running of xUnit. net tests in Visual Studio, how we can run tests using Resharper, and how we can run xUnit tests from the command line runner.

Writing Tests with xUnit.net
Hi. Welcome back to Module 2. In this module, we'll go into more depth on how we can use xUnit. net to create tests. In this module, we'll spend a bit of time looking at the different Assert methods such as Assert. Equal to check for equality, Assert. Null to check that something is null, and Assert. Throws to check that an exception is thrown when we expect it. We'll also look at how we can temporarily stop a test from running and how we can group tests into categories to allow us to run subsets of them. We'll also learn how we can set up code to execute before and after each individual test executes.

Data-driven Tests
Hi. Welcome to Module 3, Data-Driven Tests. In this module, we'll see how we can refactor individual tests and create a single data-driven test using inline data. We'll then see how we can use property data-driven tests to allow multiple test classes to use the same set of test data. We'll see how we can specify our test data in Excel and have our tests retrieve test data from Excel. And finally, we'll look at how we can retrieve our test data from SQL Server.

Advanced Techniques
Hi. Welcome back to Module 4. In this module, we'll be looking at some advanced techniques that we can use when working with xUnit. net. In this module, we're going to learn how we can create custom Trait attributes to help us perform tasks such as categorizing tests. We'll also look at how we can create custom Data attributes to create custom test data providers. We'll introduce AutoFixture, which enables us to create anonymous test data and how we can use AutoFixture with xUnit. net to create anonymous data-driven tests. Finally, we'll look at how we can combine xUnit. net, AutoFixture, and Moq to perform automocking while at the same time providing anonymous test data.

xUnit.net for NUnit users
Hi. Welcome to this final module of this xUnit. net course. In this module, we'll get a feel for how the xUnit. net attributes and asserts compare with the NUnit attributes and asserts. If you're an existing NUnit user, you may find this module useful as a frame of reference to get started with xUnit. net. So, in this module, we'll get an overview of the NUnit attributes and what their equivalents are where there are equivalents in xUnit. net. So, these include the attributes to mark things as tests and how to perform operations such as test setup and teardown. We'll also cover two styles of exception checking in NUnit and how it equates to the xUnit. net style of checking for exceptions. Finally, we'll go through some of the assert methods in NUnit and see their equivalents in xUnit. net. And here we'll see that the xUnit. net versions tend to be a little more terse.