Patch files
Use the --patch-only=<patch-file>
argument to define a patch file - Diffblue Cover will only write tests for the code changes defined in the patch file (any class in the patch and any related/dependent classes).
Command line argument
Usage: --patch-only=<patch-file>
Alternative: -p=<patch-file>
Example: --patch-only=path/to/file.patch
Use diff or a similar tool to create a patch file for your changes in your project - for example:
git diff origin/develop > file.patch
.For a multi-module project, generate the patch at the root of the project and provide the absolute path to the patch file, using
--working-directory
with the relative path to the module. The same patch file can be used for each module.For a project without modules, or a project where tests will only ever be created for a single module, where
--working-directory
is not used, the relative path to the patch file for the project or module only may be used - for example:
The
--patch-only
argument only accepts files in UTF-8 encoding. If using PowerShell on Windows, use the following command to get the patch in UTF-8 instead of the default UTF-16:
Create a patch file
The exact patch file you need depends on your setup, but here are some examples using git diff
. The variable DIFFBLUE_PATCH
represents the name of your patch file.
For a patch containing commits newer than the project's origin (i.e. the corresponding branch on the remote repository your local branch was created from):
For a patch containing commits on your branch newer than those on the local copy of TARGET_BRANCH
(e.g. where TARGET_BRANCH
is develop
):
For a patch containing commits on your branch newer than those on the remote host TARGET_BRANCH
(e.g. where REMOTE
is origin
and REMOTE/TARGET_BRANCH
is origin/develop
):
For a patch containing only currently uncommitted changes:
Last updated