Skip to content

Latest commit

 

History

History
47 lines (27 loc) · 1.98 KB

CaptureFilesFromCI.md

File metadata and controls

47 lines (27 loc) · 1.98 KB

How to capture .received. files from CI

Contents

Introduction

This documentation explains how to capture received files from a Continuous Integration (CI) system when tests pass on your local machine but fail on CI.

Problem Description

One of the challenges developers face is when tests pass on their local machine but fail on the CI system. This is particularly common with image or binary files but can occur with any file type.

Solution: Using FileCaptureReporter

ApprovalTests provides a reporter called FileCaptureReporter that can help address this issue. When a test fails, FileCaptureReporter adds the received file to your Git repository and pushes it. This allows you to capture feedback from a headless CI machine.

NOTE: Keep in mind that this process will create one commit per received file. If multiple tests fail, you will have multiple commits.

Here is an example:

CustomPanel panel = new CustomPanel(true, 20);
AwtApprovals.verify(panel, new Options(new FileCaptureReporter()));

snippet source | anchor

The example above demonstrates how to use FileCaptureReporter with ApprovalTests to capture received files on test failure.

Compatibility

FileCaptureReporter is currently compatible with GitHub Actions and any machine where Git is configured to allow committing and pushing from the command line. You can extend this compatibility as needed for your specific system.