All Projects → approvals → Approvaltests.java

approvals / Approvaltests.java

Licence: apache-2.0
ApprovalTest verification library for Java

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Approvaltests.java

Snapguidist
Snapshot testing for React Styleguidist
Stars: ✭ 287 (+79.38%)
Mutual labels:  snapshot-testing
Opticlj
A Clojure(Script) expectation/snapshot testing library, inspired by cram, ppx_expect, and jest
Stars: ✭ 19 (-88.12%)
Mutual labels:  snapshot-testing
Snapshooter
Snapshooter is a snapshot testing tool for .NET Core and .NET Framework
Stars: ✭ 118 (-26.25%)
Mutual labels:  snapshot-testing
Snap.swift
Snapshot testing in a snap 🎨
Stars: ✭ 420 (+162.5%)
Mutual labels:  snapshot-testing
Pointfreeco
🎬 The source for www.pointfree.co, a video series on functional programming and the Swift programming language.
Stars: ✭ 782 (+388.75%)
Mutual labels:  snapshot-testing
Testshot
Presentational snapshot testing for React
Stars: ✭ 57 (-64.37%)
Mutual labels:  snapshot-testing
reducer-tester
Utilities for testing redux reducers
Stars: ✭ 19 (-88.12%)
Mutual labels:  snapshot-testing
Cupaloy
Simple Go snapshot testing
Stars: ✭ 131 (-18.12%)
Mutual labels:  snapshot-testing
Playbook Ios
📘A library for isolated developing UI components and automatically taking snapshots of them.
Stars: ✭ 830 (+418.75%)
Mutual labels:  snapshot-testing
Test Each
🤖 Repeat tests. Repeat tests. Repeat tests.
Stars: ✭ 89 (-44.37%)
Mutual labels:  snapshot-testing
Phpunit Snapshot Assertions
A way to test without writing actual test cases
Stars: ✭ 443 (+176.88%)
Mutual labels:  snapshot-testing
Snapshot Diff
Diffing snapshot utility for Jest
Stars: ✭ 490 (+206.25%)
Mutual labels:  snapshot-testing
Syrupy
🥞 The sweeter pytest snapshot plugin
Stars: ✭ 73 (-54.37%)
Mutual labels:  snapshot-testing
Bunit
A testing library for Blazor Components. You can easily define components under test in C# or Razor syntax and verify outcome using semantic HTML diffing/comparison logic. You can easily interact with and inspect components, trigger event handlers, provide cascading values, inject services, mock IJSRuntime, and perform snapshot testing.
Stars: ✭ 415 (+159.38%)
Mutual labels:  snapshot-testing
Buffer Components
Buffer's shared collection of React UI components 🤜🤛
Stars: ✭ 120 (-25%)
Mutual labels:  snapshot-testing
GFontsSpace
Preview: https://pankajladhar.github.io/GFontsSpace
Stars: ✭ 88 (-45%)
Mutual labels:  snapshot-testing
Enzyme To Json
Snapshot test your Enzyme wrappers
Stars: ✭ 954 (+496.25%)
Mutual labels:  snapshot-testing
Snap Shot It
Smarter snapshot utility for Mocha and BDD test runners + data-driven testing!
Stars: ✭ 138 (-13.75%)
Mutual labels:  snapshot-testing
Typescript Snapshots Plugin
Snapshots language service support for Typescript
Stars: ✭ 122 (-23.75%)
Mutual labels:  snapshot-testing
Snapper
Bringing Jest-esque Snapshot testing to C#
Stars: ✭ 85 (-46.87%)
Mutual labels:  snapshot-testing

Build Status Build Status Maven Central

Contents

ApprovalTests.Java

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

It is compatible with JUnit 3, 4 & 5 and TestNG.

The jars can be used from JDK 1.7 on up until JDK 14.

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 java scenarios including

  • HashMaps & Collections
  • Long Strings
  • Log Files
  • JPanels
  • Xml
  • Html
  • Json
  • Getting Legacy Code under tests

Documentation

Getting started

The best way to get started is download and open the Starter Project.
It is a maven project and can be imported into any editor.

How to get it

It's on Maven Central, search for 'approvaltests'. If you're using Maven, add this to your pom file:

<dependency>
    <groupId>com.approvaltests</groupId>
    <artifactId>approvaltests</artifactId>
    <version>9.5.0</version>
</dependency>

or download the jars from maven central repository

Video Tutorials

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

Note: There are a lot of videos about ApprovalTests in .Net They are equally useful for understanding the concepts despite being in a different programming language.

Podcasts

If you prefer auditory learning, you might enjoy the following podcast (Note: Some of these talk about the .net side)

Examples

ApprovalTests eats it own dogfood, so the best examples are in the source code itself.

None the less, Here's a quick look

public class SampleArrayTest
{
  @Test
  public void testList()
  {
    String[] names = {"Llewellyn", "James", "Dan", "Jason", "Katrina"};
    Arrays.sort(names);
    Approvals.verifyAll("", names);
  }
}

snippet source | anchor

Will Produce a File SampleArrayTest.testList.received.txt

[0] = Dan
[1] = James
[2] = Jason
[3] = Katrina
[4] = Llewellyn

snippet source | anchor

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. This can be an issue with git as it will change the line endings. The suggested fix is to add *.approved.* binary to your .gitattributes

More Info

LICENSE

Apache 2.0 License

Questions?

twitter: @LlewellynFalco or #ApprovalTests

Developer notes

The suggested way to contribute to ApprovalTests is to pair with Llewellyn
However, if you are set on forking please read these notes

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].