Links

Argument files

Command lines can become very long when multiple options are specified on the command line. To keep your command lines short and avoid any potential issues with terminals that don't support very long command lines, you can make use of argument files to define your optional arguments.

Config argument files

Arguments can be defined in a plain text file with an arbitrary name, e.g. config.txt. This file can then be passed to dcover create by adding the option @config.txt.
For example:
dcover create @config.txt
Options passed in this way can be added to the file one per line or separated by a space on the same line. Comments can also be added to the file.
Example file:
--verbose --batch
--patch-only 'C:\Users\My User Name\myproject\patch.diff'
# We don't want to create tests for this class (this is a comment).
--exclude a.class.i.want.ToIgnore.
If you're using this feature with PowerShell, typically on Windows, you may experience the following error:
The splatting operator '@' cannot be used to reference variables in an expression.
In this case make sure that you quote the config argument file to stop PowerShell from trying to interpret the @ symbol:
dcover create '@config.txt'

Default argument files

If you have a certain set of arguments that you frequently use with dcover create or dcover upload, you can add them to plain text files in the following locations instead of using the @ notation on the command line:
  • .diffblue/create.args
  • .diffblue/upload.args
This will allow you to run a command with common arguments, without having to repeatedly specify them on the command line.
These files are command-specific, so any arguments added to .diffblue/create.args will only affect the dcover create command and likewise any arguments added to .diffblue/upload.args will only affect the dcover upload command. Without these files in the particular location, all desired arguments will have to be specified when running the relevant command.
Arguments added to these default configuration files can be overriden by specifying them, either on the command line or in a separate config argument file denoted by @config.txt. For example, assuming you had the following arguments in your .diffblue/create.args file:
--class-name-template "\${CLASS_NAME}Test"
--coverage-reports
You would be able to override these values by specifying them like so: dcover create --class-name-template="\${CLASS_NAME}DiffblueTest" --coverage-reports=false.
It should be noted that mutually exclusive parameters cannot be overridden. As a result, if you add these parameters to your default argument file, you will need to temporarily move or rename the file to be able to specify a different value. Currently, the following parameters are mutually exclusive:
  • --maven and --gradle