Skip to content

Approval Tests
Syndicate content
Updated: 2 hours 3 min ago

What's new in ApprovalTests.Net v3.7

Thu, 07/03/2014 - 22:56
[Available on Nuget]
AsyncApprovals - rules and exceptions[Contributors: James Counts]In the end, all tests become synchronous. This means for a normal test we recommendHowever, If you are looking to test exceptions everything changes and you might want to use Removed BCL requirement[Contributors: James Counts &  Simon Cropp]HttpClient is nice way of doing web calls in .Net. Unfortunately, at this time the BCL in nuget does unfortunate things to your project if you do not wish to use the HttpClient. This is a violation of a core philosophy of approvaltests 
"only pay for the dependencies you use
HttpClient was add ApprovalTests 3.6. Thanks to Simon for pointing and troubleshooting this error. It has now been removed. 
Wpf Binding Asserts[Contributors: Jay Bazuzi]This is a bonus from v3.6It is a very hard thing to detect and report Wpf Binding Error. To even get the reports to happen you have to fiddle with the registry and then read and parse logs.No More!  Now to you use BindsWithoutError to ensure that your Wpf binding are working.

Categories: Open Source

What's new in ApprovalTests.Net v3.6

Wed, 06/18/2014 - 11:17
I finally got a new version released. It's been a lot time in the making and I wanted to highlight some of the new feature. There's a bunch so hold on tight:

VerifyNoAbandonedFilesOne issue that pops up with approvals is sometimes old approval files end up abandoned in the source tree. Now you can write a simple test that will prevent this



Asp ScrubbersIt's great that ApprovalTests can so easily capture web pages, but it can still be hard to get those pages as consistent as a Unit test needs them to be. Inspired by Geoff Bache's TextTest, scrubbers have been included.

Scrubbers are simple Functions that take a input string and return a clean version of it. Here's an example to remove the GUID used by asp for forms

SimpleLogger.MarkSimpleLogger is a easy way to both capture behavior for locking test as well as see performance data for simple profiling but it was also hard to get everywhere a method would exit. Now you don't have to, simply use a using around the method like this.

StatePrinterApprovalsLocking down legacy code can be hard when none of the objects have a good ToString. Enter StatePrinterApprovals. Using the nuget package StatePrinter you can easily print and capture even highly complex and recursive object graphs.Rest Calls Finally there is a simple object to create your own Rest Calls that are both easy to Mock (because they implement ILoader) and easy to Test. Here's the Testing Logicand here the code to test it.

VerifyJsonIt's always been easy to verifyJson, but now it will be pretty printed as well

Serializable Theory TestUsing Theory based testing, you can now test that any object can be serialized and consumed to recreate the original object. It's as simple as 

WindowRegistry.AssertsYou can also easily assert that WindowsRegistry Values are in place with

WriterFactoryApprovalTests is more extensible with the introduction of WriteFactory. An easy way to insert your own FileWriters if you need them
ApprovalDataScenariosFinally, the last big change is the introduction of DataScenarios. This allows you to use data driven test cases to produce multi approved files.
Categories: Open Source