It is possible to execute ANALYZE without requiring any user interactions as a so-called batch command. This allows ANALYZE to run automatically, e.g., on a continuous integration (CI) server, like Jenkins. This way you can automatically perform certain tasks on a regular basis, e.g., creating reports, documenting the current project state, or archiving it.
When starting ANALYZE in batch mode, it is necessary to provide the appropriate configuration and the workspace as command-line parameters. While running, ANALYZE will load artifacts and links according to the configuration, and it will export its entire knowledge into a generic CSV schema. When that export is finished, the application terminates successfully.
There is a multitude of command-line options available, which you can use to change ANALYZE’s behavior in batch-mode execution. As ANALYZE is based on Eclipse, you can use all Eclipse command line switches . ANALYZE also comes with specific switches. The table below lists all ANALYZE specific switches and important Eclipse switches .
The batch mode should always be called with the parameters -application com.yakindu.traceability.batch.application -data
workspace -nosplash --launcher.suppressErrors
. Additional command-line options are optional, unless mentioned otherwise below. The following options are supported:
Option | Description | Type |
---|---|---|
-application com.yakindu.traceability.batch.application
|
Tells ANALYZE to run in batch mode. This option is mandatory. | Eclipse |
-data
folder
|
Sets the workspace for ANALYZE execution to the given file system path. The path can be relative or absolute. This option is mandatory. Example: -data workdir specifies the folder
<current OS working directory>/workdir as workspace.
|
Eclipse |
-nosplash
|
Avoids application splash screen. This option is strongly recommended. | Eclipse |
--launcher.suppressErrors
|
If specified, the executable will not display any error or message dialogs. This option is strongly recommended. | Eclipse |
-config / Project[/ folder…]/ file
|
Path to the ANALYZE configuration file. The path is an absolute path in the Eclipse workspace. This option is mandatory unless --loadSnapshot is specified. The Project containing the file must be imported via --import . Example: -conf "/Sample.project/conf/demo.conf.analyze" loads the file
demo.conf.analyze from project
Sample.project , folder
conf .Can be abbreviated as -conf .
|
ANALYZE |
--loadSnapshot
file
|
As alternative to activating a given ANALYZE configuration which specifies relevant data and their mappings, you can load data from a snapshot which in turn contains a configuration file. The
file must hold the absolute file system path to a ANALYZE snapshot file. Example: -loadSnapshot "C:\archive\ytsnapshots\Snapshot_232143.analyzesnapshot" The options --loadSnapshot and --config are mutually exclusive.
|
ANALYZE |
--configParameterFile
file
|
File system path to a properties file with
parameter values for the configuration. You can only specify parameters and values which are defined in the ANALYZE configuration file (see help section linked above). Examples: --configParameterFile ".\myYTParams.txt" loads the parameters from
myYTParams.txt which resides in the current working directory.--configParameterFile "C:\batchjob\conf\myYTParams.txt" loads the parameters from
myYTParams.txt which resides in the fully specified path.
|
ANALYZE |
--configparameter parameter= value
|
Explicitly sets the active
value of a
parameter in the configuration. You can specify any number of parameters. A --configparameter has precedence over --configParameterFile . You can only specify parameters and values which are defined in the ANALYZE configuration file (see help section linked above).Examples: --configparameter variant=A sets the value
A for the
variant parameter. --configparameter variant=A --configparameter release=J sets two parameters.
|
ANALYZE |
--forceConfigParameter parameter= value
|
Explicitly sets the active
value of a
parameter in the configuration. You can specify any number of parameters. A --forceConfigParameter has precedence over --configparameter . It is possible to force a value even if it is not specified as possible value in the configuration.Examples: --forceConfigParameter variant=A sets the value
A for the
variant parameter. --forceConfigParameter variant=A --forceConfigParameter release=J sets two parameters.
|
ANALYZE |
--timeout
seconds
|
How long to wait for the ANALYZE core to initialize and adapters to become ready (seconds). To say it casually, this is the time to wait for ANALYZE loading data. If the timeout expires and ANALYZE has not yet finished loading all data, no data will be extracted, except if the
--continueNotReady option is given. Example: --timeout 120 set a waiting time of two minutes.
|
ANALYZE |
--continueNotReady
|
This option forces ANALYZE to export its data, even if a timeout occurred (see the
--timeout option). Use this option with caution, since the exported data most likely is an incomplete representation of your traceability!
|
ANALYZE |
-import folder[; folder…]
|
Specifies the folder(s) containing the project(s) which are to be loaded into the workspace. If this option is set, all projects in the specified folder(s) and their direct children folders will be imported. Multiple folders can be provided by separating them using the system’s path separator, which is
; on Windows and
: on Linux and macOS. Can be abbreviated as
-i . Example: -i „C:/work/platform-projects;./i2/current-project” loads all projects from C:/work/platform-projects and /i2/current-project (relative to working directory). This option is mandatory if you use the --config or at least one --queries option (as they refer to projects residing in the workspace).
|
ANALYZE |
--keepOpen
|
Keeps the application open after the export has been finished. The user needs to close the application explicitly. This option is useful for debugging. After exporting, the user can for instance browse traceability data to verify whether the correct data is included in the export or not. | ANALYZE |
-output
file-shortname
|
Name of the file documenting the export statistics (number of exported artifacts and links per type, resp.). As the exported data, the statistics file will be created in the
export_gen folder in the batch workspace. Can be abbreviated as -o .Example: -data workdir -output stats configures ANALYZE to export the statistics into file
./workdir/stats.log .
|
ANALYZE |
--showDialogs
|
Shows dialogs (e.g. for warnings or errors) in the UI thread instead of printing console messages. This may be helpful for debugging. | ANALYZE |
--queries / Project[/ folder…]/ queryfile
|
Executes the queries in the
query file that is referenced by the path to
queryFile. The path is an absolute path in the Eclipse workspace. Results of queries which are declared as
private are not exported. It writes the result for each query both into a CSV file and an Excel file. The CSV file has the same name as the corresponding query, followed by the
.csv filename extension, the Excel file gets the
.xslx extension. An additional
structure.json json file is written describing the structure of the executed query. You can use --queries repeatedly to execute queries in more than one file. Example: --queries P1/queries/demo.queries --queries P2/demo.queries exports the results of file
demo.queries (residing in project
P1 , folder
queries ) and
demo.queries (residing in root-folder of project
P2 ).
|
ANALYZE |
--queryOutputFormat * outputFormat
|
Specify if queries should be exported als CSV or Excel files. Defaults to ‚CSV,Excel’ for both formats if not specified. | ANALYZE |
-reportDesign absolutePath/ reportDesignFile.rptdesign
|
Generates reports based on the report design file that is referenced by the path to reportDesignFile_. The path is an absolute path to the *.rptdesign file. Additionally, a parameter --reportOutputFormat specifies the output format of the Report generated. The values can be EXCEL, WORD, PDF, HTML etc. If the report file already exists and is appendable (e.g Excel formats), then the new report is appended to the existing file. Else, the file is overwritten and a new report is created.You can use --reportDesign repeatedly to generate report for more than one report design template file. Example: --reportDesign C:\P1\reports\demo1.rptdesign --reportDesign C:\P1\reports\demo2.rptdesign --reportOutputFormat EXCEL generates two reports based on the design files
demo1.rptdesign (residing in folder
P1 ) and
demo2.rptdesign.
|
ANALYZE |
--snapshot / folder[/ folder…]
|
Creates a
ANALYZE-snapshot in the given folder. The folder is resolved in the workspace directory which had been specified by the -data parameter. Example: -data workdir --snapshot "./export-gen/Snapshot20200909" creates the snapshot in file
workdir/export.gen/Snapshot20200909.analyzesnapshot The options --snapshot and --loadSnapshot are mutually exclusive.
|
ANALYZE |
--properties file
|
System path to a properties file containing
Java system properties. You can specify a relative path (relative to working directory) or an absolute file path. Supported properties by adapters are: DOORS:
Example: --properties ./analyze.props reads system properties from file
analyze.props in the current working directory.
|
ANALYZE |
-eclipse.keyring file
|
Eclipse’s secure store saves data in an encrypted form to provide a single sign-on experience. It helps you to define credentials to log in e.g. to PTC Integrity during remote runs. To achieve this:
Hint: You can find you current secure store location via the ANALYZE Menu Window > Preferences > General > Security > Contents You can specify a relative path (relative to working directory) or an absolute file path. Example: -eclipse.keyring C:\users\smith\.eclipse\org.eclipse.equinox.security\secure_storage
|
Eclipse |
-eclipse.password password
|
The master password for Eclipse’s secure store | Eclipse |
--logFile file
|
Specifies the name of the log file for the batch run. The path is resolved relative to the current working directory. It the file already exists, the log of the new run is appended to the file. Example: --logFile yt.application.log specifies the log file
yt.application.log in the current working directory.
|
ANALYZE |
--logLvl level
|
Specifies the log level threshold for the batch run. Possible values are TRACE, DEBUG, INFO, WARN,ERROR, and FATAL. Example: --logLvl FATAL . |
ANALYZE |
--maxLogFileSize filesize
|
Specifies the maximum log file size. If the log file exceeds this size, it is „rolled”. I.e. the logfile will be renamed from
logFile to
logFile.1 and for additional log statements a new file
logFile is created. The maximum backup index is 1 – ANALYZE won’t create a file
logFile.2 . That means if one run produces 3 MB of log statements and the maxLogFileSize is set to
1MB , you will lose log data Example: --maxLogFileSize 4MB
|
ANALYZE |
--help
|
Lists all available options and their descriptions. Can be abbreviated as -? .
|
ANALYZE |
--deltaFor file
|
Specifies filepath of the snapshot file for which delta report has to be generated with respect to selected configuration with
-i or selected snapshot with
--l Example: --deltaFor "C:\archive\ytsnapshots\Snapshot_232143.analyzesnapshot"
|
ANALYZE |
--uploadProjectID Project ID
|
Specifies the project ID where the snapshot has to be uploaded for the batch run. Example: --uploadProjectID 665 specifies the 665 as the project ID. The projectID can be seen in the URL of the
upload dialog.
|
ANALYZE |
Examples
Here’s an example for a typical ANALYZE batch run call
.\analyze\ANALYZE.exe -application com.yakindu.traceability.batch.application -nosplash --launcher.suppressErrors -data batch_workspace -import „./ANALYZE/workspaces/xsam” -conf „/Sample/input_ea/ea_demo.conf.analyze” -o batchrun.log --queries /Sample/Export.query --queries /Sample/ExportStats.query
It imports all projects from "./ANALYZE/workspaces/xsam" into workspace "batch_workspace" , activates the specified /Sample/input_ea/ea_demo.conf.analyze and exports all raw data and the results of all queries residing in /Sample/Export.query or /Sample/ExportStats.query , resp., into folder batch_workspace/export_gen .
Here is an example for batch run call to generate delta report from the selected configuration
.\analyze\ANALYZE.exe -application com.yakindu.traceability.batch.application -nosplash -data batchworkspace -i „C:\projects\ANALYZE\workspace” -conf „/com.excel.files.test/conf.analyze” --deltaFor „C:\projects\ANALYZE\ANALYZE-Snapshots/test.analyzesnapshot” -console -consoleLog
It imports all projects from "C:\projects\ANALYZE\workspace" into workspace "batch_workspace" , activates the specified configuration /com.excel.files.test/conf.analyze and creates a delta report for the current configuration as snapshot and the snapshot specified in the -deltaFor option into folder batch_workspace/export_gen with the name as DeltaReport.xlsx
Note : Specified configuration /com.excel.files.test/conf.analyze in the above example is relative to workspace selected C:\projects\ANALYZE\workspace
Here is an example for batch run call to generate delta report from the loaded snapshot
.\analyze\ANALYZE.exe -application com.yakindu.traceability.batch.application -nosplash -data batchworkspace -i „C:\projects\ANALYZE\workspace” --loadSnapshot „C:\projects\ANALYZE\ANALYZE-Snapshots\demo.analyzesnapshot” --deltaFor „C:\projects\ANALYZE\ANALYZE-Snapshots\test.analyzesnapshot” -console -consoleLog
It imports all projects from "C:\projects\ANALYZE\workspace" into workspace "batch_workspace" , loads the specified snapshot C:\projects\ANALYZE\ANALYZE-Snapshots\demo.analyzesnapshot and creates a delta report for the current loaded snapshot and the snapshot specified in the -deltaFor option into folder batch_workspace/export_gen with the name as DeltaReport.xlsx
Here is an example for batch run call to generate delta report from the selected configuration
.\analyze\ANALYZE.exe -application com.yakindu.traceability.batch.application -nosplash -data batchworkspace -i „C:\projects\ANALYZE\workspace” --loadSnapshot „C:\projects\ANALYZE\ANALYZE-Snapshots\demo.analyzesnapshot” --uploadProjectID 665 -console -consoleLog
It imports all projects from "C:\projects\ANALYZE\workspace" into workspace "batch_workspace" , loads the specified snapshot C:\projects\ANALYZE\ANALYZE-Snapshots\demo.analyzesnapshot and uploads this snapshot to the Analyze web project with id as 665. This batch run needs username and password of Analyze web user account where project is located.
Here are different ways to assign username and password properties :
Ex :
.\analyze\ANALYZE.exe -application com.yakindu.traceability.batch.application -nosplash -data batchworkspace -i „C:\projects\ANALYZE\workspace” --loadSnapshot „C:\projects\ANALYZE\ANALYZE-Snapshots\demo.analyzesnapshot” --uploadProjectID 665 -console -consoleLog -DANALYZE_WEB_LOGIN_USERNAME=Test_User -DANALYZE_WEB_LOGIN_PASSWORD=passwordText
Kindly set ANALYZE_WEB_LOGIN_USERNAME and ANALYZE_WEB_LOGIN_PASSWORD as environment variables with their appropriate values.
The batch application terminates with exit code 0 when no error was detected. In case of errors, we return other codes depending on the error type, as summarized in the following table:
Exit code | Cause |
---|---|
0 | Regular termination |
1 | Incomplete or invalid parameters from command line |
2 | An exception occurred, but ANALYZE was shut down |
3 | An error occurred that avoids clean shutdown (like VirtualMachineError or OutOfMemoryError) |
In case of severe errors reported by the virtual machine which would avoid any handling by ANALYZE, we directly return the corresponding error codes.
With each batch run, ANALYZE exports all traceability data (artifacts, links, configured artifact types, configured link types) into CSV files. Like query results, the CSV files are created in folder export_gen inside the batch-workspace. The design of the files in intended to support a relational database scheme, so it can be imported easily into any RDBMS.
Batch export CSV schema
If a
conf.analyzedbmapping
file exists beside the configuration file some scripts are generated in the batch run into the „export-gen” folder of the specified workspace.
The file contains mapping information from artifacts or links to tables in the database and artifact or link attributes to columns of the table. Beside the specified columns the tables must have an
id
column for the foreign key reference to the artifact or link in the
LinkableArtifact or
Link table and a
date
column for the current date and time.
The content of the analyzedbmapping file looks like this:
Map from "/Showcase_WiperWasher.Traceability/conf/conf.analyze" to
"jdbc:mysql://localhost/yt-data?serverTimezone=Europe/Berlin&user=yt&password=yt-password" {
ArtifactMapping "Software Requirements" to table "requirements" {
"idx" to "RM_ID"
"text" to "shortDescription"
}
ArtifactMapping "Software architecture" to table "customer_requirement" {
"id" to "ARCH_ID"
}
LinkMapping "TracePointTypeB ⇔ TracePointTypeB" to table "customer_requirement_to_system" {
"id" to "SYS_ID"
}
}
It starts with a reference to the corresponding configuration file, followed by the connection string to validate the file and provide content assist. The connection string is not used for the import.
By default these scripts will be generate if one .analyzedbmapping file is found:
These scripts can be called in the specified order against a mysql connection to import the data.