Skip to content

Commit

Permalink
Merge branch 'master' into approval-id
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbechtold committed Jan 21, 2018
2 parents 8746d0e + aae6170 commit 142a6aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# golden-master
A harness for writing [Golden Master tests](https://dzone.com/articles/testing-legacy-code-golden) in Java
A harness for easy writing of [Golden Master tests](https://dzone.com/articles/testing-legacy-code-golden) in Java. Follow the JitPack button below in order to include it in your project.

[![](https://jitpack.io/v/maxbechtold/golden-master.svg)](https://jitpack.io/#maxbechtold/golden-master) [![Build Status](https://travis-ci.org/maxbechtold/golden-master.svg?branch=master)](https://travis-ci.org/maxbechtold/golden-master)

## Requirements
Java 8
## Benefits

* No cumbersome boilerplate code - focus on your program instrumentation
* Built-in repetitions - easily verify 10, 100, or 10,000 program inputs
* IDE integration - continuous visual feedback

## How to use (preliminary explanation)
![screenshot](src/main/resources/docs/ide-support.PNG)

You basically implement a [JUnit 5 templated test](http://junit.org/junit5/docs/current/user-guide/#writing-tests-test-templates) like so (check out ``ExampleGoldenMasterTest`` for a more detailed example):
## How to use (basic explanation)

You basically implement a [JUnit 5 templated test](http://junit.org/junit5/docs/current/user-guide/#writing-tests-test-templates) like so (check out [ExampleGoldenMasterTest](src/test/java/maxbe/goldenmaster/example/ExampleGoldenMasterTest.java) for a more detailed example):

```java
@GoldenMasterTest
Expand All @@ -26,8 +31,14 @@ public class ATest {
}
```

When you run your test for the first time, the outputs will serve as the initial *master files*. You are asked to *approve* the previous outputs by manually executing a generated script file.
When you run your test for the first time, the outputs will serve as the initial *master files*. You are asked to *approve* the previous outputs by running the tests again and then manually executing a generated script file*.

Every successive test run will then be matched against those master files - and fail if there are changes (e.g. due to mistakes during refactoring of the tested code).

If you change the tested code in a manner you consider *valid*, you can approve any changes that result in the output files by running the provided approval script.

*(I'm working on [simplifying this step](https://github.com/maxbechtold/golden-master/issues/2))


## Requirements
Java 8
Binary file added src/main/resources/docs/ide-support.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 142a6aa

Please sign in to comment.