recheck icon indicating copy to clipboard operation
recheck copied to clipboard

Detect modifications of project files for project setup

Open diba1013 opened this issue 4 years ago • 0 comments

Before submission, please check that ...

  • [x] this is related specifically to recheck and not its extension (e.g. recheck-web).
  • [x] the documentation does not mention a similar solution (e.g. possible configurations).
  • [x] there are no open or closed issues that are related to this idea.
  • [x] this, to my best knowledge, will not break something else.

Problem

When introducing changes to the default project files (all files within src/main/resources which are placed into .retest), the user must either delete the respective file (and potentially loose any custom modifications) or adapt the changes themselves (and we therefore must provide concise steps to replicate the changes made [e.g point to a commit]).

However, if the user did not touch these files (i.e. their content is equal to the default project files), it is save to assume that they can be replaced directly. This would remove the need for the user to replace the file themselves if they never edited these.

Solution

Terminology: 1. The old file refers to the default file before the change. 2. The new file refers to the default file after the change. 3. The project file refers to the file within the project directory .retest.

Thus it would be beneficial to have some kind of merging strategy for the project files.

  • Currently, the new file is only replaced if the corresponding project file does not exist.
  • Checksum: Save the checksum of the old file, compare it with the corresponding project file and replace with the new file if equal.

Following things should be respected:

  1. the implementation should remain computationally cheap as this might get called a few times during a test.
  2. any files provided from the resources folder will be accessible in standard folder form during development, but will be packaged into a jar for a production release.

Implementation Outline

The method ProjectConfiguration#ensureProjectConfigurationInitialized checks if the project has been setup before. All checks are performed here and may copy any file specified from src/main/resources to the project directory.

Additional Context

This might also be useful when considering #297 and we decide to save the provided filters somewhere on the file system.

diba1013 avatar Jun 03 '20 12:06 diba1013