ApprovalTest verification library for .Net
Switch branches/tags
Nothing to show
Clone or download
Latest commit 1f61bd7 Oct 17, 2018
Permalink
Failed to load latest commit information.
ApprovalTests.AppConfig.Tests split out appconfig nuget (#243) Aug 26, 2018
ApprovalTests.AppConfig split out appconfig nuget (#243) Aug 26, 2018
ApprovalTests.EntityFramework.Tests remove mono Sep 2, 2018
ApprovalTests.EntityFramework move to net461 Aug 21, 2018
ApprovalTests.EntityFrameworkUtilities move to net461 Aug 21, 2018
ApprovalTests.MSTest move to net461 Aug 21, 2018
ApprovalTests.MSpec move to net461 Aug 21, 2018
ApprovalTests.MachineSpecific.Tests move to net461 Aug 21, 2018
ApprovalTests.MsTestV2 t move VsTestStackTraceNamerTests to mstestV2 Sep 2, 2018
ApprovalTests.NHibernate.Tests move to net461 Aug 21, 2018
ApprovalTests.NHibernate fix spelling Aug 28, 2018
ApprovalTests.Rdlc.Tests move to net461 Aug 21, 2018
ApprovalTests.Rdlc move to net461 Aug 21, 2018
ApprovalTests.StatePrinter.Tests update to StatePrinter 3.0.1 (#245) Oct 2, 2018
ApprovalTests.StatePrinter update to StatePrinter 3.0.1 (#245) Oct 2, 2018
ApprovalTests.Tests add UniqueForRuntime Sep 2, 2018
ApprovalTests.WinForms.Tests move to net461 Aug 21, 2018
ApprovalTests.WinForms move to net461 Aug 21, 2018
ApprovalTests.Wpf.Tests remove mono Sep 2, 2018
ApprovalTests.Wpf remove mono Sep 2, 2018
ApprovalTests.Xunit move to net461 Aug 21, 2018
ApprovalTests.Xunit2 disable disable xUnit1006: Theory methods should have parameters Sep 2, 2018
ApprovalTests use default params Sep 8, 2018
ApprovalUtilities.Tests xunit and netcoreapp2.1 for utils tests Sep 2, 2018
ApprovalUtilities split CollectionUtilities into partials and conditinal compilation Sep 2, 2018
Common Added Reporters, External Images to RDLC, w/jim Jul 8, 2013
DatabaseBackups insults backup Jul 5, 2018
Docs/Images Image Jun 17, 2014
ReportingDemo redundant whitespace Mar 25, 2018
build MyGet support files/changes Nov 27, 2013
lib/ReportViewer MyGet support files/changes Nov 27, 2013
nuget_cli added nuget cli Mar 5, 2018
packages Xunit 2 support Mar 23, 2015
.editorconfig add editor config Mar 24, 2018
.gitattributes sql is text Jul 4, 2018
.gitignore cleaned ignore file Jul 5, 2018
.travis.yml trying to enable nuget Aug 28, 2015
ApprovalTests.build Inital Transfer from sourceforge Jan 24, 2013
ApprovalTests.ncrunchsolution Inital Transfer from sourceforge Jan 24, 2013
ApprovalTests.properties.example Inital Transfer from sourceforge Jan 24, 2013
ApprovalTests.sln split out appconfig nuget (#243) Aug 26, 2018
ApprovalTests.sln.DotSettings fix spelling Aug 28, 2018
ApprovalTests.vsmdi Inital Transfer from sourceforge Jan 24, 2013
ApprovalsKeyPair.snk Changing nuget packing w/simon May 25, 2013
DeployToNuget.cmd version Oct 2, 2018
Directory.Build.props v3.0.18 Oct 17, 2018
LICENSE.md Starting Documentation Jan 24, 2013
LocalTestRun.testrunconfig Inital Transfer from sourceforge Jan 24, 2013
MyGet.cmd redundant whitespace Mar 25, 2018
readme.md Fix hyperlinks (markdown) in readme Mar 31, 2017

readme.md

ApprovalTests

Capturing Human Intelligence - ApprovalTests is an open source assertion/verification library to aid unit testing.

It is compatible with most .Net unit testing frameworks (Nunit, MsTest, Xunit, MBUnit)

What can it be used for?

Approval Tests can be used for verifying objects that require more than a simple assert. They also come prepackaged with utilities for some common .Net scenarios including

  • Dictionaries & Collections
  • Long Strings
  • Log Files
  • Asp.Net
  • Asp.Net Mvc
  • Winforms
  • Wpf
  • Entity Framework
  • Rdlc reports

Video Tutorials

You can watch a bunch of short videos on getting started and using ApprovalTests in .Net at YouTube

Podcasts

If you prefer auditory learning, you might enjoy the following podcast

Available on NuGet

Install-Package ApprovalTests

Nightly (CI) Builds available at myget.org:

ApprovalTests Nightly Build Status

ApprovalTests on the MyGet Gallery Note: Select "Include Prerelease" instead of "Stable Only" (-IncludePrerelease in powershell)

Examples

Sample Code

   	[UseReporter(typeof(DiffReporter))]
	[TestFixture]
	public class SampleTest
	{
		[Test]
		public void TestList()
		{
			var names = new[] {"Llewellyn", "James", "Dan", "Jason", "Katrina"};
			Array.Sort(names);
			Approvals.VerifyAll(names, "");
		}
	}

Will Produce a File

SampleTest.TestList.received.txt
[0] = Dan
[1] = James
[2] = Jason
[3] = Katrina
[4] = Llewellyn

Simply rename this to SampleTest.TestList.approved.txt and the test will now pass.

Approved File Artifacts

The *.approved.* files must be checked into source your source control. ApprovalTests now ignores line endings by default (so you can remove *.approved.* binary from your .gitattributes file if you added previously).

If you would like to verify line endings, simply add [assembly: IgnoreLineEndingsAttribute(false)] to your AssemblyInfo.cs

Do not add *.received.* files to your source control (they are transitory, and some SCMs like TFS will lock them or mark them read-only, which will break every dependent test).

More Info

LICENSE

Apache 2.0 License

Questions?

ask on twitter: @LlewellynFalco or #ApprovalTests