public static class TcasesCommand.Options extends Object
[-c tupleSize]
[-f outFile]
[-g genDef]
[-n]
[-I]
[-o outDir]
[-p name=value]
[-r seed] [-R]
[-t testDef]
[-T contentType]
[-v]
[-x transformDef | -J | -H]
[inputDef]
where:
-c tupleSize
If -c is defined, use the given default tupleSize for all generators. This updates the generator definitions specified by the
genDef file.
-f outFile
If -f is defined, test definition output is written to the specified outFile, relative to the given outDir.
If omitted, test definitions are written to the file specified by the -t option.
If an output path cannot be derived, output is written to standard output.
-g genDef
If -g is defined, test definitions are created using the generator(s) specified
by the given genDef file. If omitted, the default generator definition is used.
The default generator definition is read from the corresponding *-Generators
file in the same directory as the inputDef,
if it exists. Otherwise, the default TupleGenerator
is used for all functions.
-H
If -H is defined, test definition output is transformed into an HTML report. The resulting HTML file is written to the specified outDir.
-J
If -J is defined, test definition output is transformed into Java source code for a JUnit
test class. The resulting Java source file is written to the specified outDir. The
following parameters (see the -p option) affect the results of this transform.
class
The name of the class under test. If omitted, the default is defined by the system
parameter.
system
The name of the system under test. If omitted, the default is defined by the inputDef.
throws
A boolean value (true/false, yes/no). If true, generated test methods are declared to throw Exception.
If omitted, the default is false.
values
A boolean value (true/false, yes/no). If true, comments listing all input variable assignments
are included in the body of each test method.
If omitted, the default is true.
-n
If -n is defined, any previous contents of the testDef are ignored.
If omitted, new test definitions are based on the previous testDef.
-I
If -I is defined, no test definitions are produced. Instead, a JSON document containing the effective
system input definition is written to the outDir. The effective system input definition, which is used to generate
test definitions, is the result of normalizing all input schemas and adding any schema-derived value definitions.
-o outDir
If -o is defined, test definition output is written to the specified directory.
If omitted, the default outDir is the directory containing the inputDef or,
if reading from standard input, the current working directory. If an output path cannot be
derived, output is written to standard output.
-p name=value
Defines the value of a transform parameter. Any number of -p options may be specified.
This option is meaningful only if the -x or -J option is given.
-r seed
If -r is defined, use the given random number seed for all generators. This updates the generator definitions specified by the
genDef file.
-R
Choose a new random number seed for all generators. This updates the generator definitions specified by the
genDef file.
-x transformDef
If -x is defined, test definition output is transformed according to the XSLT transform defined
by the transformDef file. If relative, the transformDef path is assumed to be relative to the
directory containing the inputDef.
-t testDef
If -t is defined, new test definitions are based on the contents of the specified testDef file,
relative to the directory containing the inputDef. Also, unless the -f option is given, new
test definition output is written to the specified testDef path,
relative to the outDir.
If omitted, the default testDef name is derived from the inputDef name.
-T contentType
Defines the default content type for the files read and produced. The contentType must be one of "json" or "xml".
The default content type is assumed for any file that is not specified explicitly or that does not have a recognized extension.
If omitted, the default content type is derived from the inputDef name.
-v
Prints the current Tcases version identifier to standard output.
inputDef
The system input definition is read from the given inputDef. If omitted, the system input definition is
read from standard input. Otherwise, the system input definition is read from the first one of the following files
that can be located.
- inputDef
- inputDef-Input.json
- inputDef.json
- inputDef-Input.xml
- inputDef.xml
Modifier and Type | Class and Description |
---|---|
static class |
TcasesCommand.Options.Builder |
static class |
TcasesCommand.Options.TransformType |
Constructor and Description |
---|
Options()
Creates a new Options object.
|
Options(String[] args)
Creates a new Options object.
|
Modifier and Type | Method and Description |
---|---|
static TcasesCommand.Options.Builder |
builder()
Returns a new Options builder.
|
Resource.Type |
getContentType()
Returns the default file content type.
|
Integer |
getDefaultTupleSize()
Returns the default tuple size used by generators.
|
File |
getGenDef()
Returns the generator definition file.
|
GeneratorOptions |
getGeneratorOptions()
Returns the options used by generators.
|
File |
getInputDef()
Returns the input definition file
|
File |
getOutDir()
Returns the output directory for generated test definitions.
|
File |
getOutFile()
Returns the output file for generated test definitions.
|
Long |
getRandomSeed()
Returns the random seed used by generators.
|
File |
getTestDef()
Returns the output file for generated test definitions.
|
File |
getTransformDef()
Returns the transform file.
|
Map<String,Object> |
getTransformParams()
Returns the transform parameter bindings.
|
TcasesCommand.Options.TransformType |
getTransformType()
Returns the output transform type.
|
File |
getWorkingDir()
Returns the current working directory used to complete relative path names.
|
protected void |
handleArgs(String[] args,
int i)
Handles the non-option arguments i, i+1, ...
|
protected int |
handleOption(String[] args,
int i)
Handles the i'th option and return the index of the next argument.
|
boolean |
isExtended()
Returns if new test definitions are generated by extending the
previous
test definitions . |
boolean |
isNewSeed()
Returns if choosing a new random seed used by generators.
|
protected void |
printUsage()
Prints usage information to standard error.
|
void |
setContentType(Resource.Type contentType)
Changes the default file content type.
|
void |
setContentType(String option)
Changes the default file content type.
|
void |
setDefaultTupleSize(Integer tupleSize)
Changes the default tuple size used by generators.
|
void |
setExtended(boolean extended)
Changes if new test definitions are generated by extending the
previous
test definitions . |
void |
setGenDef(File genDef)
Changes the generator definition file.
|
void |
setInputDef(File inputDef)
Changes the input definition file
|
void |
setNewSeed(boolean newSeed)
Changes if choosing a new random seed used by generators.
|
void |
setOutDir(File outDir)
Changes the output directory for generated test definitions.
|
void |
setOutFile(File outFile)
Changes the output file for generated test definitions.
|
void |
setRandomSeed(Long seed)
Changes the random seed used by generators.
|
void |
setShowEffectiveInput(boolean showEffectiveInput)
Changes if the current effective system input definition should be written.
|
void |
setShowVersion(boolean showVersion)
Changes if the current version should be shown.
|
void |
setTestDef(File testDef)
Changes the output file for generated test definitions.
|
void |
setTransformDef(File transformDef)
Changes the transform file.
|
void |
setTransformParams(Map<String,Object> params)
Changes the transform parameter bindings.
|
void |
setTransformType(TcasesCommand.Options.TransformType transformType)
Changes the output transform type.
|
void |
setWorkingDir(File workingDir)
Changes the current working directory used to complete relative path names.
|
boolean |
showEffectiveInput()
Returns if the current effective system input definition should be written.
|
boolean |
showVersion()
Returns if the current version should be shown.
|
protected void |
throwHelpException()
Throws a HelpException after printing usage information to standard error.
|
String |
toString() |
public Options()
public Options(String[] args)
protected int handleOption(String[] args, int i)
protected void handleArgs(String[] args, int i)
protected void throwHelpException()
protected void printUsage()
public void setOutDir(File outDir)
public File getOutDir()
public void setOutFile(File outFile)
public File getOutFile()
public void setTestDef(File testDef)
public File getTestDef()
public void setGenDef(File genDef)
public File getGenDef()
public void setTransformDef(File transformDef)
public File getTransformDef()
public void setTransformType(TcasesCommand.Options.TransformType transformType)
public TcasesCommand.Options.TransformType getTransformType()
public void setTransformParams(Map<String,Object> params)
public Map<String,Object> getTransformParams()
public void setInputDef(File inputDef)
public File getInputDef()
public void setExtended(boolean extended)
test definitions
.public boolean isExtended()
test definitions
.public void setRandomSeed(Long seed)
public Long getRandomSeed()
public void setNewSeed(boolean newSeed)
public boolean isNewSeed()
public void setDefaultTupleSize(Integer tupleSize)
public Integer getDefaultTupleSize()
public GeneratorOptions getGeneratorOptions()
public void setWorkingDir(File workingDir)
public File getWorkingDir()
public void setShowVersion(boolean showVersion)
public boolean showVersion()
public void setShowEffectiveInput(boolean showEffectiveInput)
public boolean showEffectiveInput()
public void setContentType(String option)
public void setContentType(Resource.Type contentType)
public Resource.Type getContentType()
public static TcasesCommand.Options.Builder builder()
Copyright © 2024 The Cornutum Project. All rights reserved.