Annotation Type SnapshotTestOptions
-
@API(status=EXPERIMENTAL, since="1.7.0") @Target({TYPE,METHOD}) @Retention(RUNTIME) public @interface SnapshotTestOptionsAllows to configure some behavior details of the snapshot testing engine. This annotation can either be placed on the test class itself or on single test methods. Annotations on test methods take precedence over the one on the test class. If the annotation is not specified at all, the documented defaults apply.If you want to globally modify the snapshot directory, see the
SnapshotDirectoryannotation.- Since:
- 1.7.0
-
-
Field Summary
Fields Modifier and Type Fields Description static intDEFAULT_CONTEXT_LINESDefault number of context lines that are displayed in diffs.static SnapshotTestOptions.DiffFormatDEFAULT_DIFF_FORMATDefault setting fordiffFormat().static SnapshotTestOptions.NormalizeLineEndingsDEFAULT_NORMALIZE_LINE_ENDINGSDefault setting fornormalizeLineEndings().
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanalwaysPersistActualResultWhether to always persist the latest actual test result in a parallel file next to the.snapshotfile.booleanalwaysPersistRawResultWhen enabled, the framework will persist the raw actual result without snapshot header as a sibling file to the real.snapshotfile with the extension.snapshot_raw.SnapshotTestOptions.DiffFormatdiffFormatDefines how the diffs within the assertion failure messages are rendered.SnapshotTestOptions.NormalizeLineEndingsnormalizeLineEndingsAdvises the framework to convert the line endings after snapshot serialization to the given value.SnapshotTestOptions.DiffLineNumbersrenderLineNumbersControls whether an offset is added to the line numbers that are displayed when rendering diffs.inttextDiffContextLinesDefines the number of context lines that are printed around a comparison failure.
-
-
-
-
DEFAULT_NORMALIZE_LINE_ENDINGS
@API(status=EXPERIMENTAL, since="1.10.0") static final SnapshotTestOptions.NormalizeLineEndings DEFAULT_NORMALIZE_LINE_ENDINGSDefault setting fornormalizeLineEndings().- Since:
- 1.10.0
-
-
-
DEFAULT_DIFF_FORMAT
@API(status=EXPERIMENTAL, since="1.10.0") static final SnapshotTestOptions.DiffFormat DEFAULT_DIFF_FORMATDefault setting fordiffFormat().- Since:
- 1.10.0
-
-
Element Detail
-
textDiffContextLines
int textDiffContextLines
Defines the number of context lines that are printed around a comparison failure. Note that this setting only applies to unified diffs created for structural comparisons. If you use text comparison, then you must control the amount of context lines usingTextSnapshot.withContextLines(int).Defaults to 5.
- Returns:
- The number of context lines to print in unified diffs within our structural assertion failures.
- See Also:
TextSnapshot.withContextLines(int)
- Default:
- 5
-
-
-
renderLineNumbers
@API(status=EXPERIMENTAL, since="1.7.1") SnapshotTestOptions.DiffLineNumbers renderLineNumbersControls whether an offset is added to the line numbers that are displayed when rendering diffs. You can choose to render line numbers according to the original raw test result or according to the physical lines in the persisted snapshot files. The latter includes some header information at the beginning of the file which add an offset to the actual data lines.Defaults to
SnapshotTestOptions.DiffLineNumbers.ACCODRDING_TO_PERSISTED_SNAPSHOT_FILE.- Returns:
- How to calculate line numbers in rendered diffs.
- Since:
- 1.7.1
- Default:
- de.skuzzle.test.snapshots.SnapshotTestOptions.DiffLineNumbers.ACCODRDING_TO_PERSISTED_SNAPSHOT_FILE
-
-
-
alwaysPersistActualResult
boolean alwaysPersistActualResult
Whether to always persist the latest actual test result in a parallel file next to the.snapshotfile. The actual result will be persisted in a file with identical name but with.snapshot_actualfile extension.Note: If you opt into enabling this option, you should add the
.snapshot_actualto your.gitignorefile. Other than the normal.snapshotfiles, the..._actualfiles are not intended to be checked into the SCM.If this option is disabled, then all existing
..._actualfiles will be proactively deleted by the framework during test execution.Defaults to false.
- Returns:
- Whether to always persist the latest actual test result.
- Default:
- false
-
-
-
alwaysPersistRawResult
boolean alwaysPersistRawResult
When enabled, the framework will persist the raw actual result without snapshot header as a sibling file to the real.snapshotfile with the extension.snapshot_raw.Note: If you opt into enabling this option, you should add the
.snapshot_actualto your.gitignorefile. Other than the normal.snapshotfiles, the..._rawfiles are not intended to be checked into the SCM.If this option is disabled, then all existing
..._rawfiles will be proactively deleted by the framework during test execution.Defaults to false.
- Returns:
- Whether to additionally persist the raw snapshot results.
- Default:
- false
-
-
-
normalizeLineEndings
@API(since="1.10.0", status=EXPERIMENTAL) SnapshotTestOptions.NormalizeLineEndings normalizeLineEndingsAdvises the framework to convert the line endings after snapshot serialization to the given value.By default, line endings are not normalized but when using GIT it is advisable to set this to
SnapshotTestOptions.NormalizeLineEndings.GIT- Returns:
- How to normalize line endings.
- Since:
- 1.10.0
- Default:
- de.skuzzle.test.snapshots.SnapshotTestOptions.NormalizeLineEndings.NEVER
-
-
-
diffFormat
@API(status=EXPERIMENTAL, since="1.10.0") SnapshotTestOptions.DiffFormat diffFormatDefines how the diffs within the assertion failure messages are rendered. Note that this setting only applies to diffs created for structural comparisons. If you use text comparison, the diff format can be controlled usingTextSnapshot.withDiffFormat(TextSnapshot.DiffFormat).Defaults to
SnapshotTestOptions.DiffFormat.UNIFIED.- Returns:
- The diff format.
- Since:
- 1.10.0
- See Also:
TextSnapshot.withDiffFormat(TextSnapshot.DiffFormat)
- Default:
- de.skuzzle.test.snapshots.SnapshotTestOptions.DiffFormat.UNIFIED
-
-