Git Product home page Git Product logo

assent's Introduction

Assent

Build status

Assent is a simple assertion library for long strings. By default it uses common diff tools to report on and resolve test failures.

It is test framework agnostic and works with .NET Framework 4.5, NET Standard 1.3 and .NET Core 1.0.

Installation

Install the package from nuget by adding Assent to your project.json dependencies or running install-package Assent from the NuGet tool window.

Usage

In your test, do your usual setup and execution, but replace your assert line with:

this.Assent("String To Assert")

The behaviour can be customised by passing a Configuration object:

var configuration = configuration.UsingExtension("json");
this.Assent("String To Assert", configuration);

You can use your favourite assertion library, see the Comparer wiki page.

When the test is run, it will look for an approved file in the same directory as the code file. See Naming on how this is achieved and how to customise this. On the first run, an empty approved file is created and the diff tool will show, allowing you to validate the tests result and copy it over to the approved file. For more detail, see How It Works

Automated Builds

Having a diff tool pop up during an automated build is not ideal, so it can be disabled by setting the AssentNonInteractive environment variable to true.

Documentation

Refer to the Wiki

Hat Tips

.NET Core Cake build scripts from https://github.com/michael-wolfenden/dotnetcore-build

Inspiration is drawn from ApprovalTests, if you need a more powerful tool, and you are using the .NET Framework, it is worth a look.

AppVeyor for supporting OSS and providing free CI builds

assent's People

Contributors

304notmodified avatar droyad avatar mjrichardson avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.