Skip to content

Commit 0706730

Browse files
committed
. d restore README.md
1 parent 7b907c8 commit 0706730

File tree

1 file changed

+119
-1
lines changed

1 file changed

+119
-1
lines changed

README.md

Lines changed: 119 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1-
21
[![FormatJava](https://github.com/approvals/ApprovalTests.Java/actions/workflows/formatJava.yml/badge.svg)](https://github.com/approvals/ApprovalTests.Java/actions/workflows/formatJava.yml)
32
[![Run tests](https://github.com/approvals/ApprovalTests.Java/actions/workflows/test.yml/badge.svg)](https://github.com/approvals/ApprovalTests.Java/actions/workflows/test.yml)
43
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.approvaltests/approvaltests/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.approvaltests/approvaltests)
54
[![Discord](https://img.shields.io/discord/1349240939406819409?logo=discord)](https://discord.gg/XDrgy6x6Se)
65
<!-- toc -->
76
## Contents
87

8+
* [What can it be used for?](#what-can-it-be-used-for)
9+
* [Documentation](#documentation)
10+
* [Missing Documentation?](#missing-documentation)
11+
* [Getting started](#getting-started)
12+
* [New Projects](#new-projects)
13+
* [Docs](#docs)
14+
* [Learning](#learning)
15+
* [How to get it](#how-to-get-it)
16+
* [Maven](#maven)
17+
* [Gradle](#gradle)
18+
* [Podcasts](#podcasts)
19+
* [Examples](#examples)
920
* [Approved File Artifacts](#approved-file-artifacts)
1021
* [More Info](#more-info)
1122
* [No Checked Exceptions Philosophy](#no-checked-exceptions-philosophy)
@@ -26,6 +37,113 @@ Supported Java versions: 8, 17, 21, 24
2637
<sup><a href='/approvaltests-tests/src/test/java/org/approvaltests/ci/JavaVersionTest.testSupportedJavaVersions.approved.txt#L1-L1' title='Snippet source file'>snippet source</a> | <a href='#snippet-approvaltests-tests/src/test/java/org/approvaltests/ci/JavaVersionTest.testSupportedJavaVersions.approved.txt' title='Start of snippet'>anchor</a></sup>
2738
<!-- endSnippet -->
2839

40+
## What can it be used for?
41+
42+
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
43+
44+
45+
- HashMaps & Collections
46+
- Long Strings
47+
- Log Files
48+
- JPanels
49+
- Xml
50+
- Html
51+
- Json
52+
- Getting *Legacy Code* under tests
53+
54+
Want to see more? Check out [Better Testing with Approvals](https://www.youtube.com/watch?v=QEdpE0chA-s)
55+
56+
## Documentation
57+
- [ApprovalTests](/approvaltests/docs/README.md)
58+
- [ApprovalTests-util](/approvaltests-util/docs/README.md)
59+
60+
### Missing Documentation?
61+
If there is documentation you wish existed, please add a `page request` to [this issue](https://github.com/approvals/ApprovalTests.Java/issues/342).
62+
63+
## Getting started
64+
### New Projects
65+
The best way to get started is download and open one of the starter projects:
66+
* Java
67+
* [Maven](https://github.com/approvals/approvaltests.java.starterproject)
68+
* [Gradle](https://github.com/approvals/approvaltests.java.starterproject.gradle)
69+
* [Kotlin](https://github.com/approvals/Approvaltests.Kotlin.StarterProject)
70+
* [Groovy](https://github.com/approvals/Approvaltests.Groovy.StarterProject)
71+
* [Scala](https://github.com/approvals/Approvaltests.Scala.StarterProject)
72+
73+
These are standard projects and can be imported into any editor or IDE.
74+
They also all have CI with Github actions.
75+
76+
### Docs
77+
You might also want to check out the [Getting Started Overview](approvaltests/docs/tutorials/GettingStarted.md)
78+
79+
### Learning
80+
A great way to learn Approval Tests if you are new to it is to try out the [Koans](https://github.com/approvals/ApprovalTests.java.Koans).
81+
82+
## How to get it
83+
It's on Maven Central, search for 'approvaltests'.
84+
85+
### Maven
86+
If you're using Maven, add this to your pom file:
87+
88+
``` xml
89+
<dependency>
90+
<groupId>com.approvaltests</groupId>
91+
<artifactId>approvaltests</artifactId>
92+
<version>24.22.0</version>
93+
<scope>test</scope>
94+
</dependency>
95+
```
96+
97+
### Gradle
98+
99+
```gradle
100+
dependencies {
101+
testImplementation("com.approvaltests:approvaltests:24.22.0")
102+
}
103+
```
104+
105+
or [download the jars from maven central repository](https://repo1.maven.org/maven2/com/approvaltests/approvaltests/)
106+
107+
[Video Tutorials](https://www.youtube.com/playlist?list=PLFBA98F47156EFAA9&feature=view_all)
108+
---
109+
110+
You can watch a bunch of short videos on getting started and [using ApprovalTests in Java](https://www.youtube.com/playlist?list=PLFBA98F47156EFAA9&feature=view_all) at youtube.
111+
112+
*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.
113+
114+
## Podcasts
115+
116+
If you prefer auditory learning, you might enjoy the following podcast (Note: Some of these talk about the .net side)
117+
118+
- [Cucumber Podcast](https://cucumber.io/blog/2017/01/26/approval-testing)
119+
- [Hanselminutes](https://www.hanselminutes.com/360/approval-tests-with-llewellyn-falco)
120+
- [Herding Code](https://www.developerfusion.com/media/122649/herding-code-117-llewellyn-falcon-on-approval-tests/)
121+
122+
123+
124+
## Examples
125+
126+
ApprovalTests eats it own dogfood, so the best examples are in the source code itself.
127+
128+
None the less, Here's a quick look
129+
130+
<!-- snippet: demo -->
131+
<a id='snippet-demo'></a>
132+
```java
133+
public class SampleArrayTest
134+
{
135+
@Test
136+
public void testList()
137+
{
138+
String[] names = {"Llewellyn", "James", "Dan", "Jason", "Katrina"};
139+
Arrays.sort(names);
140+
Approvals.verifyAll("", names);
141+
}
142+
}
143+
```
144+
<sup><a href='/approvaltests-tests/src/test/java/org/approvaltests/demos/SampleArrayTest.java#L8-L19' title='Snippet source file'>snippet source</a> | <a href='#snippet-demo' title='Start of snippet'>anchor</a></sup>
145+
<!-- endSnippet -->
146+
29147
Will Produce a File `SampleArrayTest.testList.received.txt`
30148
<!-- snippet: /approvaltests-tests/src/test/java/org/approvaltests/demos/SampleArrayTest.testList.approved.txt -->
31149
<a id='snippet-/approvaltests-tests/src/test/java/org/approvaltests/demos/SampleArrayTest.testList.approved.txt'></a>

0 commit comments

Comments
 (0)