xUnit.net is a
free and open-source
Free and open-source software (FOSS) is software available under a Software license, license that grants users the right to use, modify, and distribute the software modified or not to everyone free of charge. FOSS is an inclusive umbrella term ...
unit testing
Unit testing, component or module testing, is a form of software testing by which isolated source code is tested to validate expected behavior.
Unit testing describes tests that are run at the unit-level to contrast testing at the Integration ...
tool for the
.NET Framework, written by the original author of
NUnit
NUnit is an open-source unit testing framework for the .NET Framework and Mono. It serves the same purpose as JUnit does in the Java world, and is one of many programs in the xUnit family.
Features
* Tests can be run from a console runner, ...
. The software can also be used with
.NET Core and
Mono
Mono may refer to:
Biology
* Infectious mononucleosis, "the kissing disease"
* Monocyte, a type of leukocyte (white blood cell)
* Monodactylidae, members of which are referred to as monos
Technology and computing
* Mono (audio), single-c ...
.
It is licensed under
Apache License 2.0, and the source code is available on
GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
. xUnit.net works with
Xamarin
Xamarin is a Microsoft-owned San Francisco-based software company founded in May 2011 by the engineers that created Mono (software), Mono, Mono (software)#Xamarin.Android, Xamarin.Android (formerly Mono for Android) and Mono (software)#Xamarin.i ...
,
ReSharper, CodeRush, and
TestDriven.NET. It is authored by James Newkirk and Brad Wilson.
Example
Example of an xUnit.net
test fixture
A test fixture is a device used to consistently test some item, device, or piece of software. Test fixtures are used in the testing of electronics, software and physical devices.
Electronics
In testing electronic equipment such as circuit boa ...
:
using Xunit;
public class MyTests
After you compile the test, run it in your console:
C:\MyTests\bin\Debug>xunit.console MyTestLibrary.dll
xUnit.net console test runner (64-bit .NET 2.0.50727.0)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.1.0
Test assembly: C:\MyTests\bin\Debug\MyTestLibrary.dll
1 total, 0 failed, 0 skipped, took 0.302 seconds
See also
*
Test automation
In software testing, test automation is the use of software separate from the software being tested to control the execution of tests and the comparison of actual outcomes with predicted outcomes. Test automation can automate some repetitive bu ...
*
List of unit testing frameworks for .NET programming languages (includes column indicating which are based on xUnit)
*
JUnit
JUnit is a test automation framework for the Java programming language. JUnit is often used for unit testing, and is one of the xUnit frameworks.
JUnit is linked as a JAR at compile-time. The latest version of the framework, JUnit 5, resides ...
References
Further reading
*
*
External links
*
Unit Testing: xUnit , Visual Studio Toolbox , Channel 9
{{Microsoft FOSS
Extreme programming
Unit testing frameworks
Free software programmed in C Sharp
Microsoft free software
Software that uses Mono (software)
Software using the Apache license